- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2023 10:53 PM
Hi all, so i have a requiremnt to change the field value automatically and auto save.
(ie).. There is two custom tables Table A and Table B ,
Table A have field 'phase'(choice type) and Table B have field 'state'.(choice type)
when Table B field state is changed to 'work in progress' and saved, Table A field phase should change automatically to stock request (choice) and form get auto saved. how to achieve this.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2023 12:55 AM - edited 03-08-2023 12:57 AM
@SAM321
1] Now your BR will be on Table B. (After Update) and Condition as State Changes to Work in Progress.
2] In script part:
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
var procNumber = current.procurement_number; //Here,give your 'procurement number' field bakend name.
var gr = new GlideRecord("Table_A"); // Give your Table A name
gr.addQuery('sys_id', procNumber);
gr.query();
if (gr.next()) {
gr.phase = "stock_request"; // Give your Phave filed backend name and its choice 'Stock request' value
gr.update();
}
})(current, previous);
If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2023 11:36 PM
@Sonu Parab Table A field name is Phase
Table B field name is State
when table B State field is selected and saved as work in progress , Table A Phase field should be changed to stock request and saved
Table B
Table A
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2023 11:54 PM
Thank you for the snippet. Is there a field which shows the relationship between two table?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2023 12:38 AM - edited 03-08-2023 12:39 AM
@Sonu Parab yes there is Reference field (Procurement number) in table B, which is the reference of Table A.(procurement table)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2023 12:41 AM
@SAM321 okay. Then you can take help of above solution which I have shared in same thread.
Create the a BR and do script in it.
Let us know if any issue occur.
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2023 12:55 AM - edited 03-08-2023 12:57 AM
@SAM321
1] Now your BR will be on Table B. (After Update) and Condition as State Changes to Work in Progress.
2] In script part:
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
var procNumber = current.procurement_number; //Here,give your 'procurement number' field bakend name.
var gr = new GlideRecord("Table_A"); // Give your Table A name
gr.addQuery('sys_id', procNumber);
gr.query();
if (gr.next()) {
gr.phase = "stock_request"; // Give your Phave filed backend name and its choice 'Stock request' value
gr.update();
}
})(current, previous);
If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Thank you