function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Tom FarringtonTom Farrington 

Combined workflows producing workflow error based on record type

Ok, so this has had me stumped for 2 hours now.

I have a series of interconnected workflows to build a larger business processes.  I have one on the following objects: Tasks, Cases, CustomObject1.

I have successfully got tasks auto generating, filtering information into my customObject1 but after building it I now have significant volumes of workflow errors for uers.

My task has 4 record types (including 'standard').  My workflow rule for tasks is triggered based on the record type.  I.e. If recordtype1 is marked as completed then...

My problem is there are already 35,000 tasks in the system which have no record type (created before I rolled out record types), and these flag up errors as the workflow cannot access myVariable_current.RecordType.Name.

I'm pretty sure this is just for records where this is no type.

I have 2 ideas:
1) I think the simplist thing is to add an If statement to the start of each workflow criteria so that if record type = null then it won't be triggered.  However after multiple attempts I can't get this code to work:

IF(
   ISBLANK([Task].RecordTypeId ) ,
   NULL,
   AND (
      $Setup.Administration_Settings__c.Deactivate_all_Processes__c =FALSE, 
      [Task].RecordType.Name  = 'TaskRecordType1',
      (ISPICKVAL([Task].Status, "Completed"))
   )
)


Note:  I have tried null, isblank and various formulas to try and exclude the tasks with no record type.

2) Add an extra criteria to my workflow rule that says:
   When task is marked as completed and task record type = null  >  Field update  >  change record type to 'standard'.

I don't know why i'm having so many problems with it.  Error from flow is here:
The flow failed to access the value for myVariable_current.RecordType.Name because it hasn't been set or assigned.

Any help massivly appreciated as this will massivly slow me down developing the system.

Thanks all,

Tom