How to map 'Custom with Label' field with a string field in the backend table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-06-2023 11:18 PM
I have created a 'custom with label' field named 'pick month'.
or
This field is connected to a widget which is coded to take input type month.
How to map this field with the backed table field type string
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-06-2023 11:21 PM
you need to store the value of it in some hidden variable and then use that hidden variable in script to map it with target string field
you cannot directly access value of html box or any element from widget in workflow or any other script as it's in UI
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2023 12:00 AM
How to do that?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2023 12:30 AM
for that you need to define some onclick event on that html element and store the value inside some string variable on that catalog item
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2023 12:56 AM
Hello Asif,
In your submit button in Service Portal, in div tag add ng-click="c.submit()"
In Client Script :-
var c = this;
c.submit=function(){
c.data.action = 'createRecord' ;
c.server.update();
}
In Server Script :-
data.newRec ={
pick-month: '' // id of the field in html.
}
if(input && input.action === 'createRecord'){
createRecord(input.newRec);
}
function createRecord(rec){
var gr = new GlideRecord('table_name');
gr.newRecord();
gr.setValue('field_name in backend', rec.pickmonth);
gr.insert();
}
Plz Mark my Solution as Accept and helpful, If you got any help as it will help other users as well.
Regards,
Samaksh.