- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2024 07:57 AM
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.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2024 01:20 PM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2024 08:00 AM
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();
}
If my response proves useful, please mark it "Accept as Solution" and "Helpful". This action benefits both the community and me.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2024 08:33 AM
Hi Akash,
Thanks for your response. I tried this solution, still no luck.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2024 08:41 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2024 12:00 PM
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. 😞