You are here: Using BML > Functions & Scripts > Other Functions

Other Functions


Once you've mastered the standard BML functions, you can move on to the other, advanced, functions. These advanced functions use Dictionaries and pull external information from external resources, using Data Tables and a couple of functions that are specific to either configuration or commerce.



This function returns the delimited string for array attributes with $,$ as the delimiter.

This function is only used for configurable attributes.

Syntax: getarrayattrstring(SingleArray arrayIdentifier)


# Parameter Data Type Description
1 arrayIdentifier String[] The given input array.

Return Type: String

Example of getarraystr():


This function retrieves the values of configurable attributes in Commerce.



# Parameter Data Type Description
1 [documentNumber] Integer Optional: Represents the quote number.
2 configAttrVarName String Variable name of the configurable attribute from which you are retrieving data.

Return Type: String

In case of menu attributes, the returned value is the menu item variable name.

Example of getconfigattrvalue():

In the case of menu attributes, the returned value is the menu item variable name.

The System Attribute _config_attr_info has to be selected as a rule input. If it is not selected and getConfigAttrVal is used, a compile error is shown to the user.


Retrieves an old value for given variable name containing old value and document number.

Syntax: getoldvalue(variableName [, documentNumber])


# Parameter Data Type Description
1 variableName String Variable name containing old value.
2 [documentNumber] Integer Optional: Defaults to 1, which is the main document.

Return Type: String

It will return empty string for the following cases:

Example of getoldvalue():

pre1 = getoldvalue("_quote_bill_to_address");

pre2 = getoldvalue("_price_net_price", 2);


This function returns the status of the reason variable name in an approval sequence.

Syntax: Integer getreasonstatus(String)


# Parameter Data Type Description
1 reasonVarName String This is the variable name of the reason within the approval sequence.

Return Type: Integer (associated with one of the following statuses):


This function invokes global table functions.

Syntax: invoke(globalTableFunction, [delimitedData, [defaultData]])


# Parameter Data Type Description
1 globalTableFunction Function The table function to invoke.
2 [delimitedData] String The parameters, passed as a delimited string.
3 [defaultData] String  

Return Type: Boolean

Example of invoke():

The following script invokes the global function someGlobalFunction. The parameters are passed as a delimited string. If a valid string is not returned by someGlobalFunction, the default string is "error_in_rule"

params = "";

params = var_frequency + "~" + "model number";

return invoke("someGlobalFunction",params,"error_in_rule");


Evaluates whether a particular Object is null or not. Returns true if argument passed is null.

Syntax: isnull(String (or Date (or Array or (dict))))


# Parameter Data Type Description
1 obj String, Date, Array, Dictionary The Object to examine for a null state.

Return: Boolean

Example of isnull():

This evaluates to false.

If getconfigattrvalue() is called for a non-existing attribute, it returns null. If the return value is passed to isnull(), it will return true.


Logs the specified tag and time elapsed to the site's Event Log. This logging will only occur when executed outside of the debugger.

Syntax: logtime(tag, timeElapsed)


# Parameter Data Type Description
1 tag String The tag to be logged.
2 timeElapsed Integer The time elapsed for the event, saved in the log.

Return Type: Boolean

Example of logtime():


Prints into the console window of the Function Editor. Example Use Case: For debugging.

Syntax: print(String(or Array(or Dictionary(or Numeric(or Date(or Boolean))))) varName)


# Parameter Data Type Description
1 varName String, Array, Dictionary, Numeric, Date, or Boolean The item to print to the Function Editor console.

Return Type: Boolean

Example of print():


intArray = integer[]{1,2,3,4,5};

print(intArray); //

testDict =dict("string");



print textDict;//



Constant for 'Leave Value Unchanged' for Date.

Return Type: Date


Consider a date array dateArr = Date [] {getdate(), getdate()}.

If you want to keep the value of dateArr[0] unchanged, specify the following:

dateArr = String [] {$BM_UNCHANGED_DATE$, getdate()};


Constant for 'Leave Value Unchanged' for Number. This is used to specify an array value that should remain unchanged.

Return Type: Numeric

Example of $BM_UNCHANGED_NUM$:

Consider an int array intArr = Integer [] {1,2,3}.

If you want to assign new values to intArr[1] and intArr[2] but keep intArr[0] = 1, specify the following:

intArr = Integer [] {$BM_UNCHANGED_NUM$, 21,23};


Constant for 'Leave Value Unchanged' for String.

Return Type: String

Example of $BM_UNCHANGED_STR$:

Consider a string array strArr = String [] {"a","b"}.

If you want to keep the value of strArr[0] unchanged, specify the following:

strArr = String [] {$BM_UNCHANGED_STR$, "abc"};

Rule Dictionary Keys

This Closedtable lists the parameters for a rule's dictionary keys.

Partner Security Token

This Closedsection discusses the parameter BM_PARTNER_SECURITY_TOKEN.

The parameter BM_PARTNER_SECURITY_TOKEN represents the WSSE security UsernameToken for SOAP, used for sending stateless SOAP with UrlDataByPost.


...<soapenv:Header><ClientName xmlns="urn:crmondemand/ws">Bigmachines</ClientName>"+BM_PARTNER_SECURITY_TOKEN+"</soapenv:Header>...

Inserts the block

<wsse:Security xmlns:wsse=" secext-1.0.xsd"><wsse:UsernameToken><wsse:Username>User'sPartnerLogin</wsse:Username> <wsse:Password Type="">User'sPartnerPassword</wsse:Password></wsse:UsernameToken> </wsse:Security>


    NULL and blank Integer values are treated as separate values.

    - NULL= 0
    - Blank = ""

    If you use logic that tests for NULL values in rule conditions or BML, this logic should be updated.

    Using "null" as an attribute value is strongly discouraged.


Related Topics Link IconSee Also