How to Auto-populate description field value by using script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2023 01:52 AM - edited 11-16-2023 02:06 AM
Hi,
I have changed Description field is String to HTML type, But i need to know how to Auto-populate description field value by using script from catalog item (request form).
Can you please help me. It will helpful.
Thanks in Advance!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2023 02:37 AM
Hi @mania ,
You can set the description in the workflow/flow:
For workflow you can use run script as below:
current.description = "Whatever description you want to set "+current.number;
In flow designer: You can use 'Update Record' action as below:
Please mark my answer correct and helpful, if you find it useful.
Thanks,
Kavita Bhojane
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2023 02:50 AM
https://www.servicenow.com/community/itsm-forum/populate-the-task-description-field/m-p/439026
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2023 03:09 AM
Hi @mania ,
I create before insert update business rule and used below script
(function executeRule(current, previous /*null when async*/) {
var body = '';
body += '<p>Short Description: ' + current.getDisplayValue('short_description') + '</p>';//your case you can use =var html_text = current.variables.<Variable Name>;
gs.addInfoMessage(body);
current.u_html_field = body;
current.update();
})(current, previous);
Please mark it as helpful and solution proposed if it serves your purpose.
Thanks,
Anand
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2023 03:19 AM
I tried your code but not getting popup from record producer form to incident form.
Can you please suggest me.
Thanks!
Mania