How to dot-walk a reference field in the record producer form?

Chaithra S
Tera Contributor

Hello Everyone,

 

I'm working on setting Incident Description and Short Description field values from the values entered by the user from a Record Producer form.

 

I have written below code to achieve, but still the producer values are not be seen in the Description and Short Description fields of an Incident form.

 

//If Service Offering is from XYZ Service Group

var serviceOffer = producer.service_offering;

if (serviceOffer.service_group == gs.getProperty('Service Group_XYZ')) {

    //current.description = "I am having trouble with my - " + producer.service_offering.getDisplayValue() + "\n" + 'Please describe your issue below - ' + producer.please_describe_your_issue_below_conditional;

    current.description = producer.please_describe_your_issue_below_conditional.getDisplayValue();

    current.short_description = "I am having trouble with my - " + producer.service_offering.getDisplayValue();

}

 

Could you please advise what could be error here?

 

Also, I'm not sure if I'm dot-walking the Service Group value from Service Offering reference field properly. 

 

Please provide your insights. Thanks in advance.

1 ACCEPTED SOLUTION

Since u_service_group looks like it is actually a List field, rather than Reference, you need to check if XYZ group is one of the service groups for the selected service offering.  Modifying your original script would look more like this with the corrected field name and indexOf method:

//If Service Offering is from XYZ Service Group
var serviceOffer = producer.service_offering;
if (serviceOffer.u_service_group.indexOf(gs.getProperty('Service Group_XYZ')) != -1) { //XYZ group found in service group field on service offering
    current.description = producer.please_describe_your_issue_below_conditional;
    current.short_description = "I am having trouble with my - " + producer.service_offering.getDisplayValue();
}

You don't need to use getDisplayValue() on text/string variables/fields.

 

View solution in original post

13 REPLIES 13

Akash4
Kilo Sage
Kilo Sage

Hi Chaitra,

Try adding these changes according to the requirement:

 

var serviceOffer = producer.service_offering;
var serviceGroup = serviceOffer.service_group;

if (serviceGroup == gs.getProperty('Service Group_XYZ')) {
current.description = producer.please_describe_your_issue_below_conditional;
current.short_description = "I am having trouble with my - " + serviceOffer.getDisplayValue();
}

 

Regards, Akash
If my response proves useful, please mark it "Accept as Solution" and "Helpful". This action benefits both the community and me.

Chaithra S
Tera Contributor

Hi Akash,

 

Thanks for your response. I tried this solution, still no luck.

 

Brad Bowman
Kilo Patron
Kilo Patron

Is the service_offering variable a reference to the service_offering table? service_group is not the name of a field on this table, so you need to be sure you are using the correct field name.  Right-click the field label in question on the Service Offering record and choose Show... to see the Field name.  Also, if this field is the Type of reference, then the system property value must = the sys_id of the Reference table record.   

BradBowman_0-1727278752799.png

 

Chaithra S
Tera Contributor

Thank you for your response Brad. I made this change and the field name was u_service_group. It's still the same.

Somewhere, it's breaking. 😞