- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-29-2023 12:08 AM - edited 12-29-2023 01:32 AM
Hi friends,
I am working on code.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-29-2023 12:33 AM
Hi @Asmita7, I have tried inserting the problem record by UI action on Incident table and update the problem field on Incident form with the created problem record. As your requirement is almost similar, can you try something like below?
var prbId = '';
var gr = new GlideRecord('problem');
createRecord();
updateProblemField();
action.setRedirectURL(current);
function createRecord(){
gr.initialize();
gr.short_description = current.short_description;
gr.description = current.short_description;
gr.assignment_group = current.assignment_group;
prbId = gr.insert();
}
function updateProblemField(){
var grPrb = new GlideRecord('problem');
if(grPrb.get(prbId)){
current.problem_id = prbId;
current.update();
}
}
Regards,
Sunil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-29-2023 12:51 AM
Hello @Asmita7,
Please try with the below code to insert a new record in your desired table
var gr = new GlideRecord(table name);
gr.initialize();
//Set field mapping
gr.id = current.id;
gr.cost = current.cost;
var record= gr.insert();
current.field-from-your-current-table = record;
current.update();
}
}
If the above answer resolve your issue, please mark the answer as Accepted solution and also mark it as Helpful.
Thank You
Prathamesh.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-29-2023 12:33 AM
Hi @Asmita7, I have tried inserting the problem record by UI action on Incident table and update the problem field on Incident form with the created problem record. As your requirement is almost similar, can you try something like below?
var prbId = '';
var gr = new GlideRecord('problem');
createRecord();
updateProblemField();
action.setRedirectURL(current);
function createRecord(){
gr.initialize();
gr.short_description = current.short_description;
gr.description = current.short_description;
gr.assignment_group = current.assignment_group;
prbId = gr.insert();
}
function updateProblemField(){
var grPrb = new GlideRecord('problem');
if(grPrb.get(prbId)){
current.problem_id = prbId;
current.update();
}
}
Regards,
Sunil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-29-2023 12:51 AM
Hello @Asmita7,
Please try with the below code to insert a new record in your desired table
var gr = new GlideRecord(table name);
gr.initialize();
//Set field mapping
gr.id = current.id;
gr.cost = current.cost;
var record= gr.insert();
current.field-from-your-current-table = record;
current.update();
}
}
If the above answer resolve your issue, please mark the answer as Accepted solution and also mark it as Helpful.
Thank You
Prathamesh.