Business Rule Condition call Script Include

Chad Wilhelm1
Tera Expert

Hello,

We currently have this business rule which runs on story that sets Epic and Assignment Group.   We want to override this if the story is not created from an Idea.  So if a story is created manually do not set Epic and Assignment Group. So I thought call SI from BR Condition and return true if the task field on idea matches a story sys id.    Not sure what I am doing wrong here.  Any assistance is appreciated.  Thanks, Chad

find_real_file.png

find_real_file.pngfind_real_file.png

 

11 REPLIES 11

I went back and lc everything but still getting same error.  Thanks.

find_real_file.png

find_real_file.png

 

Change the script include as below

var from_Idea = Class.create();
from_idea.prototype = {
    initialize: function() {},
    checkIdea: function(grStory) {
        var gr = new GlideRecord("idea");
        gr.addQuery("task", grStory.getUniqueValue());
        gr.query();
        if (gr.hasNext()) {
            return true;
        } else
            return false;

    },
    type: 'from_Idea'
};

 

and keep the condition same as below

new from_Idea.checkIdea(current)

This will remove the error

I have just realized 1 more question during creation of rm_story, we might not be having related record in idea with task as story. Is that correct? If so we need to identify another condition how to check. 

The task field on idea stores the reference to story after creation.  Parent is Idea and Story is Child but the Child does not store reference to Parent thus query to parent passing child sys_id.  Hope this helps.   Thanks, Chad

As two more modifications are required,

We need to change the BR to after with a very high order 50000 as we are going to  current. update

current.assignment_group = "sys_id of the group";

current.setWorkflow(false);

current.update();

 

As we know current.update() is not recommended hence we are using it with 

setWorkflow