Solutions

DIm cm : how to pass parameters when executing dmpmcli addrules.js script?



ID:    S143576
Published:    12 October 2021

Product(s)

  • Dimensions CM
 

Description

how to pass parameters when executing dmpmcli addrules.js script?
for example, assume user wants to add a new transition rule with following data :
attribute = TOTO
From Status = $TO_BE_DEFINED
To Status = RAISED
Role = $ORIGINATOR
displayable = true
updatable = true
mandatory = true
how to pass these values to addrules.js script?

Resolution

see the attached screenshot as sample.

 

1_ in the source of addrules.js, define variables to receive value of parameters :

var attrname = arguments[0]
var FromStatus = arguments[1]
var ToStatus = arguments[2]
var UserRole = arguments[3]
var displayable = arguments[4]
var updatable = arguments[5]
var mandatory = arguments[6]

 

2_ optionnally, add these lines to display value of variables :

print ("param 1: "+attrname)
print ("param 2: "+FromStatus)
print ("param 3: "+ToStatus)
print ("param 4: "+UserRole)
print ("param 5: "+displayable)
print ("param 6: "+updatable)
print ("param 7: "+mandatory)

 

3_ use the variables to define the object which will be created :

var atype = null;
var details = null;
atype = findType(defaultDatabase.products.get("QLARIUS"), TypeScope.REQUEST);
details = new AttributeRuleDetails()
details.attributeName = attrname
details.currentStatus = FromStatus
details.newStatus = ToStatus
details.userRole= UserRole  
if (displayable = "Y")  details.displayable = true  
if (updatable = "Y")  details.updatable = true  
if (mandatory = "Y")  details.mandatory = true

 

4_ indicate the value of parameters in the dmpcli command line :  dmpmcli ... -file addrules.js TOTO $TO_BE_DEFINED RAISED $ORIGINATOR Y Y Y

 

5_ the transition rule is created in adminconsole

Attachment

File NameFile SizeDownLoad

Rate this Solution

Find Answers

Type a question or describe what you are looking for below

My Recent Searches

Welcome kb sso

Additional Assistance

  • Submit a Case Online
  • FAQs