Create a Child RITM for a parent RITM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-27-2023 11:36 AM
I am developing a catalog item "Create Access" which has 4 variables in form level "User Name" , "Email" , "Duration" , "Description". I am also created another form "Create Access - Child " with same 4 fields which will be generated as a child to "Create Access" through workflow once the task of the parent is closed.
My requirement is to display the information provided by users in 4 fields in Parent RITM while submitting request should be exactly auto filled in the 4 same fields in the child RITM.
For Eg. If user fills "User Name" as "Demo User" in Parent , the same field should be appeared in the child RITM created with "Demo User" in it.
Kindly let me know the possible way in order to achieve this.
Thank You!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-27-2023 12:15 PM
Hi @naga karthik1
Write a Before Insert BR as below on sc_request table
var gr = new GldieRecord('sc_request');
gr.addActiveQuery();
//Assumes the 'parent' field is on the current record and a relationship to the children
gr.addQuery('parent', current.sys_id);
gr.query();
current.user_name(User Name field on Child table) = gr.user_name;(User Name on Parent table)
current.email(email field on Child table) = gr.email;(date field on Parent table)
current.duration(duration field on Child table) = gr.duration;(duration field on Parent table)
current.description(description field on Child table) = gr.description;(description field on Parent table)
current.update();
}
Please mark the answer correct if it resolves your Query.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-27-2023 12:52 PM
Hi @Talha3,
Thanks for the quick check.
But I guess this logic won't work as the 4 fields mentioned earlier were not the fields in the table, they are variables of the particular catalog form which will be transferred to RITM once request submitted.
Please do let me know If I am correct and also suggest me any other possible ways.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-07-2024 03:30 AM
If you still need some assistance...
Add 'variables' after current like:
current.variables.user_name(User Name field on Child table) = gr.user_name;(User Name on Parent table)
current.variables.email(email field on Child table) = gr.email;(date field on Parent table)
current.variables.duration(duration field on Child table) = gr.duration;(duration field on Parent table)
current.variables.description(description field on Child table) = gr.description;(description field on Parent table)