How to get the version values for child article from Kb Knowledge table using business rule
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2023 09:27 AM
I'm trying to create a child article from parent and trying to fetch the version value from the child article .So am using business rule :
1.When after
2.Insert
3.Kb_knowledge
In advance ,below is the simple code
(function executeRule(current, previous /*null when async*/ ) {
gs.info("Checking KB log" + current.getDisplayValue("version"))
})(current, previous);
But am unable to get the version ,Please guide me
If version will take time to load in Kb_Knowledge table ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2023 10:10 PM
HI @String ,
I trust you are doing great.
Here’s a modified version of your script with additional logging. This might help in understanding what data is available at the time of the rule execution:
(function executeRule(current, previous /*null when async*/) {
// Log current record to see all available fields
gs.info("Current KB Record: " + JSON.stringify(current));
// Check if version is available
var version = current.getValue("version");
if (version) {
gs.info("Version: " + version);
} else {
gs.info("Version not available at this point");
}
})(current, previous);
Was this answer helpful?
Please consider marking it correct or helpful.
Your feedback helps us improve!
Thank you!
Regards,
Amit Gujrathi
