Task are not getting created through Business rule.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2024 02:38 AM - edited 05-07-2024 01:29 AM
Hello team,
Here I have developed a catalog item and when it is filled and submitted would create a Request under it, Along with this, I want a Catalog Task to be automatically created through BR. Here BR is getting triggered through flow but tasks are not getting created. I have checked by adding logs. but logs added in the task table are not showing up.
Here is what I have, but it did not work. Please provide any suggestions.
HERE IS THE ENTIRE CODE:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2024 05:07 AM
HI @Community Alums
I have tried by adding logs in the middle of the script. But these logs are not showing. is there any error in this part of the script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2024 05:14 AM
Hi @Munna1 ,
I checked your given script you are not closing the string, I fixed that code please refer below
var ritm = new GlideRecord("sc_req_item");
ritm.addQuery("request", 'a25428b093318a100d5170918bba10b4');
ritm.query();
if (ritm.next()) {
gs.log("LH task 3");
ritm.cmdb_ci = current.ci;
ritm.configuration_item = current.ci;
ritm.short_description = 'SRC to physically release the asset' ;
ritm.description = 'This is a notification the Asset is in the Stockroom' ;
ritm.update();
var sctask = new GlideRecord("sc_task");
sctask.addQuery("request_item", ritm.sys_id);
sctask.query();
if (sctask.next()) {
gs.log("LH task 4");
sctask.cmdb_ci = current.ci;
sctask.assignment_group = current.stockroom.assignment_group;
sctask.short_description = 'SRC to physically release the stockroom.';
sctask.description = 'This is a notification for the Asset is in the Stockroom';
sctask.update();
}
}
Please mark my answer correct and helpful if this works for you
Thanks and regards
Sarthak
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2024 03:29 AM
Hi @Maddysunil ,
Why Business rule ? why not do it with the flow/workflow which is associated with the catalog ? Any reason why Business rule.. ?
☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2024 03:54 AM
Thanks for pointing out, Ideally he should be doing it using flow/workflow as a best practice but he mentioned I want a Catalog Task to be automatically created through BR in his question along with the tried code so suggested few logs to debug.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2024 05:58 AM
Hi @Munna1
As a best practice when a catalog item is submitted you can either use flow or workflow as a best practice with no code.
with flow or workflow this can be easily achieved using "create task " activity.
Please accept the solution /mark this response as correct or helpful if it assisted you with your question.
Regards,
Animesh