- 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-26-2024 01:52 PM - edited 09-26-2024 01:54 PM
@Chaithra S you can use indexOf in this case...
var serviceOffer = producer.service_offering
if (serviceOffer && serviceOffer.service_group) {
if (serviceOffer.service_group.indexOf(gs.getProperty('Service Group_XYZ'))>-1) {
current.description = producer.please_describe_your_issue_below_conditional;
current.short_description = "I am having trouble with my - " + serviceOffer.getDisplayValue();
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2024 04:53 PM - edited 09-26-2024 04:57 PM
I made these changes Brad, still no luck.
This is how Incident form looks. Seems like the description field value is being set by a Client script, but I don't find any relevant script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2024 05:31 PM
Check for Business Rules running on the incident table. A before/after insert BR could be overwriting the field(s).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-01-2024 07:44 AM - edited 10-01-2024 07:44 AM
The issue was due to below code existed in the Record Producer. It works if I comment below code. So, I added my code to the bottom of the Record Producer script, and it works fine now.
else {
current.description = producer.description +
'\n\nScope of Issue: ' + v_scope_text + '\nService State: ' + v_service_text;
}
Thank you Brad for your help, and it really helped me to know the format to dot-walk a List field type.
Thanks everyone