• Geoffrey C
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 3
    Replies
I rarely code, so please bear with me if I'm way off....

I found this 'Auto Champion' article on creating a class and running it from the Process Builder.  https://automationchampion.com/tag/run-case-assignment-rules-for-process-builder/.  The process builder does not work when the record is edited by the pardot connector user.  My first questions is why doesnt the ProcessBuilder work when the record is edited by the PardotConnectorUser?  My second question is, will a trigger work?  If so something like this:   

Apex Trigger (not working):

trigger AssignWamLead on Lead (After Update) {
  for( lead l : trigger.new){
  if(l.rating == 'Warm' || 
     l.rating == 'Hot')
     AssignLeadsUsingAssignmentRules.LeadAssign(l.Id);
    }
}


Calls this Apex class: 

public class AssignLeadsUsingAssignmentRules
{
    @InvocableMethod
    public static void LeadAssign(List<Id> LeadIds)
    {
            Database.DMLOptions dmo = new Database.DMLOptions();
            dmo.assignmentRuleHeader.useDefaultRule= true;          
            Lead Leads=[select id from lead where lead.id in :LeadIds];
            Leads.setOptions(dmo);
            update Leads;
   }
}

- Geoff

 
Help me create this a trigger that calls an apex class if an Apex Class if a Rating Is 'Warm' or 'Hot' and is a has a Lead.RecordType of 'Marketing'.

Trigger WarmLeadd on Lead (before insert{

}

I have a custom object call 'Complaints' which has a status picklist field.  I created a trigger to write a record (another custom object called Complaint Status Record, I'll call it CSR for short) when the Status is changed.  The trigger does not work when the the status is 'New' when the complaint record is first created.

Senario 1

- Create a Complaint, default status 'New'

- Edit Complaint, Change status 'New' to 'Step 1' - No  CSR **BAD**

- Edit Complaint, Change status 'Step 1' to 'Step 2' - CSR Created *Good*

From here I can change it to anything. New, Step 3, Step 15, Closed, etc., it will create a CSR record.

 

Senario 2 - Edit Status Field.  Change default status to 'Step 1'

CSR writes on 1st update and all updates after. (It works correctly)

 

Senario 3 - Edit Status Field.  Change back to 'New' but rename to 'New Complaint'

CSR writes 1st update and all updates after. (It works correctly)

 

Senario 4 - change Status back to 'New' uncheck default box.

Same symptoms as Senario 1.

 

I checked all Workflow Rules, deactivated all the rules on complaints at one point.  No change.  I checked triggers, no triggers that should affect complaints at all (at least to my knowledge).

 

Is 'New' in a status field a reserved word?

All,

 

I created a an object to hold history of a status change indefinitely (SDFC states it only holds history for 18 months). 

There there is a complaint__c object that was created before previously.  I created a new object call Complaint_Status_Record__c to record status changes.  I also created a trigger a trigger to create a new record when the Complaint's Status is changed.   But the 1st status update does not record.....all time.

 

Scenario 1.

1.) Create a Complaint Record.  NO CSR (Complaint Status Record) is created.  OK created not updated....Status is 'New' by default

2.) Edit Complaint Record, change status 'CS Investigated'. No CSR is created.  BAD. It should create a record.

3.) Edit again, change status to anything else. A CSR is created.  Good

 

*At this point I can change a status to new, are record is created, and then change it from new to anything else and it still works.  its only the first update.

 

Senario 2.

1.) Create a Complaint Record BUT I don't take the default I choose 'CS Investigated'. No CSR Record OK.

2.) Edit Compalaint Record, change status to anything else.  Good...It works.

 

Senario 3.

One time in Production, and Existing New Complaint Record was changed and it created a CSR record. I'm not sure why this worked and if it was existing before I deployed the CSR changes.

 

OK I tried to paste the trigger, but the formating off.  Does anyone have an idea before paste and format the trigger?

 

Geoff

I have a custom object call 'Complaints' which has a status picklist field.  I created a trigger to write a record (another custom object called Complaint Status Record, I'll call it CSR for short) when the Status is changed.  The trigger does not work when the the status is 'New' when the complaint record is first created.

Senario 1

- Create a Complaint, default status 'New'

- Edit Complaint, Change status 'New' to 'Step 1' - No  CSR **BAD**

- Edit Complaint, Change status 'Step 1' to 'Step 2' - CSR Created *Good*

From here I can change it to anything. New, Step 3, Step 15, Closed, etc., it will create a CSR record.

 

Senario 2 - Edit Status Field.  Change default status to 'Step 1'

CSR writes on 1st update and all updates after. (It works correctly)

 

Senario 3 - Edit Status Field.  Change back to 'New' but rename to 'New Complaint'

CSR writes 1st update and all updates after. (It works correctly)

 

Senario 4 - change Status back to 'New' uncheck default box.

Same symptoms as Senario 1.

 

I checked all Workflow Rules, deactivated all the rules on complaints at one point.  No change.  I checked triggers, no triggers that should affect complaints at all (at least to my knowledge).

 

Is 'New' in a status field a reserved word?

All,

 

I created a an object to hold history of a status change indefinitely (SDFC states it only holds history for 18 months). 

There there is a complaint__c object that was created before previously.  I created a new object call Complaint_Status_Record__c to record status changes.  I also created a trigger a trigger to create a new record when the Complaint's Status is changed.   But the 1st status update does not record.....all time.

 

Scenario 1.

1.) Create a Complaint Record.  NO CSR (Complaint Status Record) is created.  OK created not updated....Status is 'New' by default

2.) Edit Complaint Record, change status 'CS Investigated'. No CSR is created.  BAD. It should create a record.

3.) Edit again, change status to anything else. A CSR is created.  Good

 

*At this point I can change a status to new, are record is created, and then change it from new to anything else and it still works.  its only the first update.

 

Senario 2.

1.) Create a Complaint Record BUT I don't take the default I choose 'CS Investigated'. No CSR Record OK.

2.) Edit Compalaint Record, change status to anything else.  Good...It works.

 

Senario 3.

One time in Production, and Existing New Complaint Record was changed and it created a CSR record. I'm not sure why this worked and if it was existing before I deployed the CSR changes.

 

OK I tried to paste the trigger, but the formating off.  Does anyone have an idea before paste and format the trigger?

 

Geoff