Criteria definition
Scientific Publications Cloud’s layouts, workflows, and sharing rules use customer-defined criteria to determine which layouts to display, which workflows are available to documents, and how/when to transition workflows.
Criteria fields
The contents of criteria fields should be a valid JSON document with the following structure:
{
"path":"<object>.<field API name>",
"operator":"<operator>",
"value":"<value>"
}Path
Path is a reference to an attribute that you want to base the criteria on, e.g. documentVersion.mvn__CM_Title__c or event.type.
Path for Layout Type and Workflow
When building layout type and workflow criteria, the path property is a reference to any field on CM_Document_Version__c using dot notation where documentVersion is the name of the object, e.g. documentVersion.<field API name>.
{
"path":"documentVersion.<field API name>",
"operator":"<operator>",
"value":"<document version value>"
}Note
Relationships are not supported. For example, documentVersion.Owner.Name generates a runtime exception.
Visit Layout configuration and Workflows.
Path for Workflow Stage Transition
When building workflow stage transition criteria, the path property must reference the event, documentVersion, and/or task object using dot notation. Visit Workflow Stage Transition criteria examples.
{
"path":"<object>.<field API name>",
"operator":"<operator>",
"value":"<value>"
}Path for Document Sharing Rule
When building Document Sharing Rule criteria, the path property must reference the documentVersion, product, or region object using dot notation. Visit Document Sharing Rule criteria examples and Document Sharing Rule Groups.
{
"path":"<object>.<field API name>",
"operator":"<operator>",
"value":"<value>"
}Operator
The operator specifies how the path relates to the value. The value of the operator property must be one of the following:
Includes
NotIncludes
IsNull
IsNotNull
isTrue
isFalse
Equals
NotEquals
Contains
NotContains
GreaterThan
GreaterThanOrEqualTo
LessThan
LessThanOrEqualTo
Note
Certain operators (isNull, isNotNull, isTrue, isFalse) do not require a corresponding value property.
Note
Contains and NotContains are both case sensitive.
Value
The value is the desired value of the path that you want to base the criteria on.
Value for Layout Type and Workflow
When building layout type and workflow criteria, the value of the value property is the desired CM_Document_Version__c field value.
Note
When referencing picklist fields, the value property must reference the API value of the picklist field and not the label.
Visit Layout configuration and Workflows.
Value for Workflow Stage Transition
When building workflow stage transition criteria, the value of the value property is the desired value of the path. Valid enums for event.type include:
SingleTaskCompleted - published when a single non-approval workflow activity for the current stage has been completed.
AllTasksCompleted - published when all non-approval workflow activities for the current stage have been completed.
SingleReviewerApproved - published when the first reviewer marks their activity as
Approved.AllReviewersApproved - published when all reviewers have marked their activities as
Approved.SingleReviewerRejected - published when a single reviewer has marked their activity as
Rejected.AllReviewersRejected - published when all reviewers have marked their activities as
Rejected.
Wildcard condition
To match any field value, a wildcard (*) can be used. The following criteria will match any CM_Type__c value:
{
"path":"documentVersion.mvn__CM_Type__c",
"operator":"Equals",
"value":"*"
}Compound criteria
To build more complex rules, compound criteria may be used. There are two compound criteria operators:
AnyTrue
AllTrue
To build compound criteria, wrap individual criteria statements in compound criteria operators. The following example compound criteria will display the layout if the value of CM_Document_Version__c.CM_Type__c is equal to FAQ__c or Corporate__c:
{
"AnyTrue": [
{
"path":"documentVersion.mvn__CM_Document_Type__c",
"operator":"Equals",
"value":"FAQ__c"
},
{
"path":"documentVersion.mvn__CM_Document_Type__c",
"operator":"Equals",
"value":"Corporate__c"
}
]
}Layout Type and Workflow criteria examples
CM_Document_Version__c.CreatedDate is greater than 1/1/2019{
"path":"documentVersion.CreatedDate",
"operator":"GreaterThan",
"value":"1/1/2019"
}CM_Document_Version__c.CM_Is_Latest_Version__c is false{
"path":"documentVersion.mvn__CM_Is_Latest_Version__c",
"operator":"isFalse"
}CM_Document_Version__c.CM_Title__c contains "guide"{
"path":"documentVersion.mvn__CM_Title__c",
"operator":"Contains",
"value":"guide"
}CM_Document_Version__c.Major_Version_Number__c is greater than 1{
"path":"documentVersion.mvn__Major_Version_Number__c",
"operator":"GreaterThan",
"value":1
}Workflow Stage Transition criteria examples
Approved{
"path":"event.type",
"operator":"Equals",
"value":"AllReviewersApproved"
}{
"AllTrue": [
{
"path": "event.type",
"operator": "Equals",
"value": "AllTasksCompleted"
},
{
"path": "documentVersion.mvn__CM_Document_Type__c",
"operator": "Equals",
"value": "CM_Internal_Document"
},
{
"path": "task.KLS_Type__c",
"operator": "Equals",
"value": "KLS_Review"
}
]
}Document Sharing Rule criteria examples
{
"path": "documentVersion.mvn__CM_Document_Type__c",
"operator": "Equals",
"value": "CM_Medical_Information"
}{
"path": "documentVersion.Id",
"operator": "IsNotNull"
}{
"AllTrue": [
{
"path": "documentVersion.KLS_Allowed_Users__c",
"operator": "Contains",
"value": "Frontline and Secondline"
},
{
"AnyTrue": [
{
"path": "documentVersion.mvn__CM_Document_Relationships_1__r",
"operator": "Includes",
"value": {
"path": "MED_Product__r.Name",
"operator": "Equals",
"value": "All Products"
}
},
{
"path": "documentVersion.mvn__CM_Document_Relationships_1__r",
"operator": "Includes",
"value": {
"path": "MED_Product__r.KLS_Product_Sharing_Group__c",
"operator": "Equals",
"value": "Kalos"
}
}
]
}
]
}