- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-03-2024 04:43 AM - edited ‎04-03-2024 04:45 AM
Hi experts,
I have a challenge that I am facing.
My business service field is hidden.
I would like to populate it approximately after selecting a value in the service offering.
There is a child and parent relationship between them (business service is the parent of service offering).
There is no need for a client script because the business service field is hidden and therefore the placement reads in the registration of the form.
This is the script I wrote in the record producer, but the action doesn't actually happen after I press submit.
I would appreciate your assistance
var offeringGR = new GlideRecord("service_offering");
offeringGR.addQuerry('name',producer.service_offering);
offeringGR.Querry();
if(offeringGR.next()){
current.business_service = offeringGR.parent;
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-03-2024 08:53 PM
Hi @Deepak Shaerma ,
thanks a lot for the help anyway, I was able to figure out what my problem was.
In the query, it was necessary to get the sys_id and not the name as I wrote because it is a reference field.
I will attach the corrected script here.
var offeringGR = new GlideRecord("service_offering");
offeringGR.addQuerry('sys_id',producer.service_offering);
offeringGR.Querry();
if(offeringGR.next()){
current.business_service = offeringGR.parent;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-03-2024 05:25 AM
Hi @Tal5
I found some typos error in your script and a little modification you need.
var offeringGR = new GlideRecord("service_offering");
// Correct method names: addQuery and query
offeringGR.addQuery('name', producer.service_offering);
offeringGR.query();
if (offeringGR.next()) {
current.variables.business_service = offeringGR.parent.getDisplayValue();
}
Note: Please Mark this Helpful and Accepted Solution. If this Helps you to understand. This will help both the community and me..
- Keep Learning ‌‌
Thanks & Regards
Deepak Sharma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-03-2024 08:53 PM
Hi @Deepak Shaerma ,
thanks a lot for the help anyway, I was able to figure out what my problem was.
In the query, it was necessary to get the sys_id and not the name as I wrote because it is a reference field.
I will attach the corrected script here.
var offeringGR = new GlideRecord("service_offering");
offeringGR.addQuerry('sys_id',producer.service_offering);
offeringGR.Querry();
if(offeringGR.next()){
current.business_service = offeringGR.parent;
}