cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Allow arguments on conditions, validation and action scripts

Allow arguments on conditions, validation and action scripts

It could be very handy if condition and validation scripts could take a argument.

 

It could cut down on the number of scripts needed.

 

For example:

A GenAccept script could be reused on both an Accept and Reject action if it could take a bool argument.

 

GenAccept(true)

GenAccept(false)  (negate output)

 

Allowing it to take an integer would make it even more flexible.

3 Comments
jared.sund
Alumni
Status changed to: Future Consideration

Hello plmadmin,

 

I’m not sure I fully understand this request to have condition and validation scripts accept arguments.  Condition and Validation scripts currently get predefined parameters such as dmsID, userID, transID, and customTransID.  In addition, Library scripts can be imported into a Condition or Validation script that allows reuse functions (which include parameters) across many scripts.

 

In your example of GenAccept(true/false) for a Validation script, a Library script could be created to return an empty list or a list that could contain a canned error message:

 

Library Script:  GenAccept

 

function genAccept(hasValidationError){

                var messages = [];
                if(hasValidationError === true){
                                messages.push(Canned error message here');
                }
                return(messages);
}

 

Validation Script:  testMyValues     Import:  GenAccept

returnValue(genAccept( item.SOMEFIELD === null ));

 

In this case, the generic function (genAccept()) can be used to provide a canned message as the returnValue for one or many validation upon the condition that results in true/false.  This behavior is standard in PLM 360’s scripting engine. 

 

Is this helpful, or have I missed the point of the enhancement you’re requesting?

 

Thanks,

 

-Jared  

sten
Advocate

 

Jared,

I can see how for example would work, except it does not reduce the total number of script snippets I end up with.

 

That is probably my biggest grievances with the scripting interface. There is not good way to group scripts or to jump from script to script.

Because of this I would prefer fewer scripts.

 

If I could pass arguments from the workflow editor it would go a long way. I don't want to make another script to hardcode the arguments, but instead pass in the arguments from the workflow editor.

 

Example of a generic function

 

Function Prototype:   AddMilestone(workflowState, days)

 

If I then could pass in the arguments in the workflow (example 'CLOSE [99]', 15) I would end up with something much more maintainable without having to jump around between multiple script snippets and even more browser windows.

 

 

aaron.tw
Alumni
Status changed to: Archived
 

Can't find what you're looking for? Ask the community or share your knowledge.

Submit Idea  

Autodesk Design & Make Report