Post

2 followers Follow
0
Avatar

Displaying related customer fields for custom panel on project object

Hello,

I'm trying to create a custom panel on the project object that will display information from the customer that is related to the project. I'm recycling the Financial Highlights Panel from the apps market place but I'm having a hard time seeing the related customer fields in the formula options box. Is this possible?

I'm wondering if I can do something like this:

If($Customer <> Null, ($Customer.$C_AccountOwner), "")

Can I jump objects like this? If so, what would be the correct syntax since the Formula Options don't show it. 

Thanks!

Garret Saarinen Answered

Please sign in to leave a comment.

10 comments

0
Avatar

Hi Garret,

 

You can go to the object nested fields the way you have described. You have a couple of options:

1. If($Customer <> Null, Catch(GetHyperLink($Customer.$C_AccountOwner),NULL), "")

2. If($Customer <> Null, Catch($Customer.$C_AccountOwner.Name),NULL, "")

 

You would need to use the catch function in case there's no owner.

 

Please let me know if that worked.

 

Good luck!

Tamir

Tamir Avital 0 votes
Comment actions Permalink
0
Avatar

I'm getting a different error message now: 

What I have: 

If($Customer <> Null, (Catch(GetHyperLink($Customer.$C_ClientSuccessConsultant),NULL)), "")

Error message:

Error: Invalid input found '$C_ClientSuccessConsultant', expected input ')'

Garret Saarinen 0 votes
Comment actions Permalink
0
Avatar

To be more specific, here is the full HTML that I'm using:

 

<div class="tbl-container">
<table class="tbl">
<tr><td class="lbl">CSC: </td><td class="val">{If($Customer <> Null, (Catch(GetHyperLink($Customer.$C_ClientSuccessConsultant),NULL)), "")}</td></tr>
<tr><td class="lbl">Account Code: </td><td class="val" style="color:{if($PlannedBudget >= $ActualCost ,'#93a939','#db2717')};">{$C_AccountCode}</td></tr>
<tr><td class="lbl">Market: </td><td class="val">{$C_Market}</td></tr>
<!-- <tr><td class="lbl">% Profitability: </td><td class="val" style="color:{if($PercentProfitability > 30,'#93a939','#db2717')};">{Round($PercentProfitability,1)} %</td></tr> -->
</table>
</div>

Garret Saarinen 0 votes
Comment actions Permalink
0
Avatar

Hi Garret,

 

What is the field type of the field $C_ClientSuccessConsultant ?

 

Thanks,

Tamir

Tamir Avital 0 votes
Comment actions Permalink
0
Avatar

Its a reference to object field with the object being 'User'

Garret Saarinen 0 votes
Comment actions Permalink
0
Avatar

Oh.. sorry my bad. There's an extra $, the correct syntax would be: 

{If($Customer <> Null, (Catch(GetHyperLink($Customer.C_ClientSuccessConsultant),NULL)), "")}

 

BTW - based on the other field in the HTML, I don't understand the object that you are on since, you shouldn't have $Customer and $PlannedBudget on the same object. In case you are trying to pull related Customer information on a project level Business Rule, you should change the Run On from CurrentObject to Customers and replace $Customer to TargetObject.

 

Regards,

Tamir

Tamir Avital 0 votes
Comment actions Permalink
0
Avatar

Sorry about the confusing code (I'm was still editing code from the Financial Highlights panel). 

This Custom Panel is going to be on the project object and I want to reference fields from the related customer to be displayed on the project. This will save our users from having to click around and saves time from having to push data from customer fields into project fields. 

I tried the last example you gave me but now the error I get is: 

Error: Invalid field name: 'Customer'

I don't see an option to change the object to 'Run On' for a Custom Panel. How would I adjust that?

Also, BTW- you rock Tamir!

Garret Saarinen 0 votes
Comment actions Permalink
0
Avatar

Is referencing a related customer possible on a project level custom panel?

Garret Saarinen 0 votes
Comment actions Permalink
0
Avatar

Hi Garret,

 

The way to access the related customer from a project based custom panel is by leveraging variables.

For example, let just say that you want to generate an HTML table with fields from the related customers.

You define a text area variable as the first action, and use the second action to Run On > Customers and then use TargetObject and its nested field and populate the data into the variable. The last step would be to leverage the variable in the Custom Panel fields.

 

Please let me know if that helped.

 

Regards,

Tamir

Tamir Avital 0 votes
Comment actions Permalink