In which order are workflow items processed? - sugarcrm

I have a number of workflow items on cases in SuiteCRM.
How can I determine the order in which these items are processed? In my situation, I am setting the priority of the case based on the values of some integer fields. However, these integer fields must first be populated based on the values of some dropdowns.
How can I make sure they are populated in the correct order? I can't see an order of execution with the workflow items.

Workflow simply pulls the workflow items to run using get_full_list which will just give the items in whatever order the database returns them (probably by id).
The alternatives are to add a new hidden flag field to the case to signify that the values have been set then check this in the workflow conditions.
Allowing setting a priority for a workflow would be a good addition however and I've added this on the SuiteCRM GitHub: https://github.com/salesagility/SuiteCRM/issues/280

Related

Is it possible to query in ADO by work item created in the current iteration? So that the query can update with each new iteration

I would like to display the results of a query that identifies the bugs created in the current iteration. AKA "new bugs". I know this can be done by using the created date but that requires the date to manually updated for each new iteration.
Is it possible to leverage the 'current iteration' in the query? Or some way that does require a manual update.
I have tried using only 'current iteration' but this returns all bugs in the current iteration limited by the state that I specify. The result is not limited by when it was created.
I have tried to add a clause for created date, which works, but is not dynamic. meaning it does not increase as the iteration grows in number of days.
Yes, you can add a and/or clause like below
I have a second drop-down list as we have different Teams, so it wants me to tell it which Team I want to bring back items for, from the #CurrentIteration.

How to pass value of a field from Parent Work Item to Child in Azure DevOps

I need to write a rule to copy a field's value to child work item(User Story) from parent work item(Epic) in Azure DevOps. But I cannot find a way using Work item's rule settings in Process.
How can I set the field in work item when parent is set.
There isn't a built-in feature can pass value between different work items. The rule only applies to the same work item. For example, we can set a copy rule to copy the value from one filed to another within the same work item.
See Rules and rule evaluation and Add a rule to a work item type for details.
The only way I can think of is writing a script by calling the Get Work Item REST API to get the value of the filed from parent work item, then calling the Work Items - Update REST API to update the child work item. Then setup a trigger to run the scripts once the parent work item is updated.

NetSuite workflow to update a record of different type

I have two NetSuite records that have a parent-child relationship. Let's call them P and C
The Child records (e.g. C123,124, etc) are listed on the Parent (P987) in a sublist.
I have a need to display the most recently updated child record (e.g. C124) in the main area of the related Parent record. I need to display 3 fields from that child record:
name
field1
field2
Second question: I might need to make one or more of fields displayed above (e.g. field1) editable. If so, would I have to store that as fields on the parent also? And then how would I keep this "copy" updated in sync with that specific Child record?
It doesn't have to be a workflow but I prefer to use "supported" features (such out of the box workflow actions) as much as possible and avoid customization by scripting. If you don't think it can be done without a script then please be clear.
P.S. Fairly new to NetSuite but not the concepts.
P.P.S. no I am not happy about the problem above and wish I could prevent all silly requests. lol
First one you can achieve with a Workflow action script.
Second question, if those are custom fields, you'd have to make them populate the info on the child record, this can be done from the same WFA script.

Run workflow over all entities to copy data from one field to another

I'm in a situation where i need to add a default value "blank" to my "Two Options" field. Since I cannot set a default value of "null" to an already created Two Options field, I though of creating a new custom field of type "Option Set" and add the same two options Yes/No in addition to setting the Default value to Unassigned.
I need to create a workflow that copies the old values choices into the new field. I understand that I can't simple equate the values of two fields of different type but I'm going to do that with Check conditions to set the new field value corresponding to the old field value.
I'm not sure how to run this workflow against all the existing records in my CRM online with no codes. Is that possible ?
Without using code or custom tools your best options are:
Do an advanced find, select all the records in the view and run the workflow - this will run the workflow against every record. You can view up to 250 records at a time (check personal settings to change this) so this might work for you.
Export all the data to Excel, make the change in Excel in bulk. Reimport the data. This way you don't need workflow at all.

Detect when a record is being cloned in trigger

Is there a way to detect that a record being inserted is the result of a clone operation in a trigger?
As part of a managed package, I'd like to clear out some of the custom fields when Opportunity and OpportunityLineItem records are cloned.
Or is a trigger not the correct place to prevent certain fields being cloned?
I had considered creating dedicated code to invoke sObject.Clone() and excluding the fields that aren't required. This doesn't seem like an ideal solution for a managed package as it would also exclude any other custom fields on Opportunity.
In the Winter '16 release, Apex has two new methods that let you detect if a record is being cloned and from what source record id. You can use this in your triggers.
isClone() - Returns true if an entity is cloned from something, even if the entity hasn’t been saved.
getCloneSourceId() - Returns the ID of the entity from which an object was cloned.
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_sobject.htm#apex_System_SObject_getCloneSourceId
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_sobject.htm#apex_System_SObject_getCloneSourceId
One approach, albeit kind of kludgy, would be to create a new field, say original_id__c, which gets populated by a workflow (or trigger, depending on your preference for the order of execution) when blank with the salesforce id of the record. For new records this field will match the standard salesforce id, for cloned records they won't. There are a number of variations on when and how and what to populate the field with, but the key is to give yourself your own hook to differentiate new and cloned records.
If you're only looking to control the experience for the end user (as opposed to a developer extending your managed package) you can override the standard clone button with a custom page that clears the values for a subset of fields using url hacking. There are some caveats, namely that the field is editable and visible on the page layout for the user who clicked the clone button. As of this writing I don't believe you can package standard button overrides, but the list of what's possible changes with ever release.
You cannot detect clone operation inside the trigger. It is treated as "Insert" operation.
You can still use dedicated code to invoke sObject.Clone() and exclude the fields that aren't required. You can ensure that you include all fields by using the sObject describe information to get hold of all fields for that object, and then exclude the fields that are not required.
Hope this makes sense!
Anup