• Deepak Kala
  • NEWBIE
  • 15 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 4
    Replies

Hi I am trying to implement a code which prefix Dr before lead name when a lead is inserted or updated. I was able to do with trigger.  Now I tried to implement it with handler pattern.

My trigger

trigger PrefixDoctorTrigger on Lead (before insert, before Update) {
PrefixDoctorTriggerHandler doctor = new PrefixDoctorTriggerHandler ();
//Before Insert
if(Trigger.isInsert && Trigger.isBefore){
doctor.OnBeforeInsert(Trigger.New);
}
// Before Update
else
if(Trigger.isUpdate && Trigger.isBefore){
doctor.OnBeforeUpdate( Trigger.old, Trigger.New, Trigger.newMap);
}
}

Handler class:

public with sharing class PrefixDoctorTriggerHandler {
public void OnBeforeInsert(List<Lead> newLeads) {
for(Lead l:newLeads){
l.FirstName = 'Dr.'+ l.Firstname;
}
}
public void OnBeforeUpdate(List<Lead> oldLeads, List<Lead> updatedLeads, map<Id, Lead> LeadMap) {
/*
what would come here*/
}
}

How should I write this portion of On Before Update, so that my code give correct result?

 

Regards,
Deepak

Hi everyone!

I have an issue and I cannot figure it out what's the problem.
I have created a flow for changing shipping method and updating delivery address. When I run the flow with my system administrator profile everything goes as expected. When I try to run with a supervisior profile I have an issue when it tries to update some fields on OrderDeliveryGroupSummary Object and I have this error: : INVALID_FIELD_FOR_INSERT_UPDATE: Unable to create/update fields: DeliverToCountry, DeliverToCity, DeliverToName, DeliverToState, DeliverToPostalCode, DeliverToStreet. Please check the security settings of this field and verify that it is read/write for your profile or permission set

The problem is that I checked the object permission for this profile and it has the same permission as a system administrator. I gave access for everything this flow needs. These fields are not visible in the object because they are address type I believe, they are visibile only in Workbench, so I can not give access directly to these fields, but it's the same for System administrator and it works. How to solve this issue? Please help

Thank you!

Hi I am trying to implement a code which prefix Dr before lead name when a lead is inserted or updated. I was able to do with trigger.  Now I tried to implement it with handler pattern.

My trigger

trigger PrefixDoctorTrigger on Lead (before insert, before Update) {
PrefixDoctorTriggerHandler doctor = new PrefixDoctorTriggerHandler ();
//Before Insert
if(Trigger.isInsert && Trigger.isBefore){
doctor.OnBeforeInsert(Trigger.New);
}
// Before Update
else
if(Trigger.isUpdate && Trigger.isBefore){
doctor.OnBeforeUpdate( Trigger.old, Trigger.New, Trigger.newMap);
}
}

Handler class:

public with sharing class PrefixDoctorTriggerHandler {
public void OnBeforeInsert(List<Lead> newLeads) {
for(Lead l:newLeads){
l.FirstName = 'Dr.'+ l.Firstname;
}
}
public void OnBeforeUpdate(List<Lead> oldLeads, List<Lead> updatedLeads, map<Id, Lead> LeadMap) {
/*
what would come here*/
}
}

How should I write this portion of On Before Update, so that my code give correct result?

 

Regards,
Deepak

I'm stuck on a simple Trailhead module Get Started with Enterprise Territory Management.

The Challenge is fairly straightforward.
  • Turn on the Enterprise Territory Management feature and accept the default access level: View and edit accounts assigned to the territory
  • Create a territory type called Managed Accounts with a priority of 100 and this description: Actively managed accounts
  • Create a territory model called Current Calendar Year with this description: Territory model for the current calendar year
  • In the Current Calendar Year territory model, create a territory called US East Coast with territory type Managed Accounts and this description: Managed accounts on US East Coast


The feedback is:
Challenge Not yet complete... here's what's wrong: 
Did you enter the correct description for the territory?


As best I can tell I have the setup correct. Any ideas?

User-added image

User-added image

 

Hello All,
I have completed this challenge.

1-For this first you need to create a helper formula field(type-percent) 
Percent Completed :
(DATEVALUE( CreatedDate ) - CloseDate )/100


2- Then you need to create the actual formula field (type- text) by using the helper formula field.
Opportunity Progress :

IF( Percent_Completed__c <=25,"Early", 
IF(Percent_Completed__c <=75,"Middle", 
"Late"))

Thanks,
Nida