- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2024 09:54 AM
Hi Team,
I want to get the details from the request item description Field we have the below details and that need to be copy to the sctask new Fields.
I have all the details in request item description like,
What is your contractor's personal email address?: sfsd@mail.com
What start date would you like for this contractor?: 2024-07-29
What end date would you like for this contractor?: 2024-08-10
Will your contractor need a badge?: Yes
I have created new Field in sctask table PersonalEmail.
I want to get the personal email details from the request item description to the PersonalEmail Field.
like , I want to get some other details also for the same.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2024 11:49 AM
@Barathk You can create an onBefore insert business rule on your SC task and keep the following script in the business rule script field.
(function executeRule(current, previous /*null when async*/) {
// Your code here
var descriptionArry = current.request_item.decription.split('\n');
for (var i = 0; i < descriptionArry.length; i++) {
var itemArray = descriptionArry[i].split(':');
if (itemArray.length == 2) {
gs.info('Question is ' + itemArray[0]);
gs.info('Answer is ' + itemArray[1]);
//Set your fields here.
}
}
})(current, previous);
Hope this helps.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2024 11:49 AM
@Barathk You can create an onBefore insert business rule on your SC task and keep the following script in the business rule script field.
(function executeRule(current, previous /*null when async*/) {
// Your code here
var descriptionArry = current.request_item.decription.split('\n');
for (var i = 0; i < descriptionArry.length; i++) {
var itemArray = descriptionArry[i].split(':');
if (itemArray.length == 2) {
gs.info('Question is ' + itemArray[0]);
gs.info('Answer is ' + itemArray[1]);
//Set your fields here.
}
}
})(current, previous);
Hope this helps.