- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-12-2023 06:52 AM
We have created catalog item after the submission the values of variable need to store into Custom table.
How can we implement this in an appropriate way. please guide us.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-12-2023 11:41 AM
You can satisfy your requirement without writing any code.
1) Trigger = Service Catalog
2) Use "Get Catalog Variables" action to get variables from your catalog Item
3) Use "Create Record" action and select your table. Then, match table fields with catalog Item variables
4) You can close the RITM by using "Update Record" action accordingly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-12-2023 07:10 AM
Hi @priyanka0709 ,
You can write a Before Business rule on sc_req_item and add the following script in there.
when: before insert
script:
var set = new GlideappVariablePoolQuestionSet();
set.setRequestID(current.sys_id);
set.load();
var vs = set.getFlatQuestions();
var varArr='';
for (var i=0; i < vs.size(); i++) {
if(vs.get(i).getLabel() != '') {
varArr+=vs.get(i).getLabel() + " = " + vs.get(i).getDisplayValue()+'\n';
}
}
var gr= new GlideRecord('sc_request');
gr.get(current.request);
gr.description=varArr;
gr.update();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-12-2023 07:18 AM
Hello @priyanka0709 ,
i am not sure why you need to do that bu you can do that in the flow designer, create an custom action and pass the sys_id of RITM <input of the action is the sys_id of RITM>
Then you do something like this
for( var field in variablesObj ) {
I haven't tried this just wrote it in here, test it first
Hope that this helps you!
If the provided information answers your question, please consider marking it as Helpful and Accepting the Solution so other community users can find it faster.
All the Best,
Stefan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-12-2023 08:27 AM
What should be the table name and when it will run?
Do we need to give same variable name into custom table?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-12-2023 10:47 PM
Hello @priyanka0709,
I was thinking more of a scripting approach, used when you want to copy variables from one RTIM to another, but @Alp Utku is going to be more user-friendly.
You should go that way and map your variables to whatever variables of your custom table you want, using just the data from your Get Catalog Variables activity.
Hope that this helps you!
If the provided information answers your question, please consider marking it as Helpful.
All the Best,
Stefan
