Populate Task Data Fields From A Related Module Using SuiteCRM Workflow and Calculate Fields

Facebooktwittergoogle_pluspinterestby feather

Workflow doesn't make it exactly easy to populate fields in one module from another in certain situations. By using the "Action" of Calculate Fields, one can "pull" field information to use that isn't available in "Modify Record."

Objective:

I want to populate (using modify) custom fields in Tasks module from the parent module. In this case, I want to add a CSR and AGENT to every Task for tracking and assigning. Having the data fields in the task itself will allow the fields to be used when other modules are sub to the original Task. For example, having quick checkboxes to push the task back and forth between a CSR and AGENT as an account gets worked on and approved/modified along the way.

Problem:

Because SuiteCRM uses "Parent Types" and then IDs, the "Modify Record" doesn't appear to have the parent's fields available to use for automation workflows.

Solution:

- (I already have a CSR and Agent data fields in Tasks Module)

- Add a Data field titled "Parent Account" (or something easily identifiable" to Tasks. You don't have to have this field in edit or detail view, albeit I included it while testing to make sure it was populating correctly.

- Create workflow that is conditioned upon a Task having a parent type of "Account."

-  Retrieve the Account ID from the Account Parent and populate the new "Parent Account" field within Tasks using an ACTIONS of Modify Record. In this case, I have a record type of Tasks, and Add Field of "Account Assigned" and a Field of "Parent ID," which will populate with the Account's NAME, and not the serial ID assigned in SuiteCRM (thank goodness). 

- Create another Action, this time the Select Action will be "Calculate Fields"

- no parameters are required (from the Tasks module) for this exercise, albeit if you're using this as a template for something else similar, you may want fields.

- Relation parameters are used, and using "Accounts : Account Assigned" I then select the field desired, and it creates the variable of {R0} to use, and I repeat and get the next one of {R1}. In this use, I only need two, albeit you can change the number from the parent as you see fit.

- Formulas, I use "two" and they're as simple as you can get. I simply use the drop down to find the appropriate data field in the Tasks module that I want populated, and cut and paste each one in the correct "Formulas."

I looked for the what text modifications etc… would be required and didn't find anything that looked correct, so I simply tried the raw value and it appears to work correctly (I haven't completed extensive testing yet).  If you know of a better way, please leave a comment below.

That said, here's the Text info from the SuiteCRM wiki…..

Text Functions

Text functions are used to manipulate text in various ways. All the functions listed here are fully supports UTF-8 texts, so special characters should not raise any problems.

substring

Signature {substring(text; start; length)}
Parameters text: text value
start: decimal value
length [optional parameter]: decimal

 

value

Description Cuts the substring of a text field from start.

 

If the length optional parameter is not set, then it cuts all characters until the end of the string, otherwise cuts the provided length. Indexing of a text’s characters starting from 0.

Returns Substring of the given text
Example call {substring(This is my text; 5)} returns

 

is my text

{substring(This is my text; 5; 5)}

 

returns is my

length

Signature {length(parameter)}
Parameters parameter: text value
Description Count the characters in a text.
Returns The count of the characters in a text.
Example call {length(sample text)} returns 11

replace

Signature {replace(search; replace; subject)}
Parameters search: text value
replace: text value
subject: text value
Description Replace all occurrences of search

 

to replace in the text subject.

Returns subject with replaced values.
Example call {replace(apple; orange; This is an apple

 

tree)} returns This is an orange tree

position

Signature {position(subject; search)}
Parameters subject: text value
  search: text value
Description Find position of first occurrence of

 

search in a subject

Returns Numeric position of search in

 

subject or -1 if search not present in subject

Example call {position(Where is my text?; text)}

 

returns 12

lowercase

Signature {lowercase(parameter)}
Parameters parameter: text value
Description Make text lowercase
Returns The lowercased text.
Example call {lowercase(ThIs iS a sAmPlE tExT)}

 

returns this is a sample text

uppercase

Signature {uppercase(parameter)}
Parameters parameter: text value
Description Make text uppercase
Returns The uppercased text.
Example call {uppercase(ThIs iS a sAmPlE tExT)}

 

returns THIS IS A SAMPLE TEXT

 

Comments

comments

Call and receive expert consulting or click below for quote
Button linked to quote page for commercial insurance quote