- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-26-2022 12:23 PM
I am working on a POC to create a record on a custom table from a request item using a Flow. I am able to create the record, but it is not setting the value of one of the fields. The variable the value should come from is a lookup select box that references the business application table and the field on the custom table also references the business application table. I am not sure what needs to be done to get that value to populate.
These are the variables:
This is the Flow Action:
This is the Flow:
This is the function in the script include:
createAppURL: function(inputArgs) {
var appURLObj = {};
appURLObj.u_business_application = inputArgs.business_application;
var URLGr = new GlideRecord("sn_apm_application_url");
URLGr.initialize();
URLGr.setValue('u_environment', inputArgs.environment);
URLGr.setValue('u_url', inputArgs.url);
URLGr.setValue('u_business_application', inputArgs.business_application);
if (URLGr.insert())
return true;
else
return false;
},
And this is the result I get:
Any assistance would be appreciated.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-27-2022 07:25 AM
Thank you, Rohila.
I was able to accomplish what I wanted by adding a glide record to the script include:
createAppURL: function(inputArgs) {
var baSysId= '';
var baGr = new GlideRecord("cmdb_ci_business_app");
baGr.addQuery('name', inputArgs.business_application);
baGr.query();
if(baGr.next()){
baSysId = baGr.sys_id;
}
var URLGr = new GlideRecord("sn_apm_application_url");
URLGr.initialize();
URLGr.setValue('u_environment', inputArgs.environment);
URLGr.setValue('u_url', inputArgs.url);
URLGr.setValue('u_business_application', baSysId);
if (URLGr.insert())
return true;
else
return false;
},
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-27-2022 07:09 AM
Hi Tedwards
the variable is a lookup select box and you are mappint it to refernce field.
can you share how you've configured the variable.
the variable should have 'lookup value field' set to sys_id so that value for the choice will be stored as sysid and you can map it while accessing.
or
you need to query the table and get the record matching record with the variable value selected
Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-27-2022 07:25 AM
Thank you, Rohila.
I was able to accomplish what I wanted by adding a glide record to the script include:
createAppURL: function(inputArgs) {
var baSysId= '';
var baGr = new GlideRecord("cmdb_ci_business_app");
baGr.addQuery('name', inputArgs.business_application);
baGr.query();
if(baGr.next()){
baSysId = baGr.sys_id;
}
var URLGr = new GlideRecord("sn_apm_application_url");
URLGr.initialize();
URLGr.setValue('u_environment', inputArgs.environment);
URLGr.setValue('u_url', inputArgs.url);
URLGr.setValue('u_business_application', baSysId);
if (URLGr.insert())
return true;
else
return false;
},
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-28-2022 12:39 AM
Hi Ted
Did my reply answer your question? If my response helped please close the thread by marking appropriate response as correct so that it benefits future readers.
Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP