• Imtiaz Pasha
  • NEWBIE
  • 20 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 27
    Questions
  • 32
    Replies
Hi All plz help if anyone know this , i want to write in a trigger or apex class , my requirment is from third party they are update lead stage lead status and call stage , but i want when the lead stage is Metting scheduled , lead status is meeting scheduled and call stage is meeting scheduled shouldnot get update from third party to any other stage .
please help me how to write logic for this.
public class LeadtoGenesys {
    @future(callout=true)
    public static void Callout(String LeadId){
       try{
            Leadtogenesys__c data1 = Leadtogenesys__c.getvalues('genesysapi');
            Lead l = [select id,Name,Email,MobilePhone,Source__c,Project_Name__c,Region__c,Channel__c,City,DC_Lead_Source__c,LastModifiedDate,Follow_Up_Date_Time__c,LastModifiedBy__c,DC_Campaign_Source__c,DSA__c,DSAname__c,Lead_Owner_Name__c,CreatedBy.id,DC_Lead_Status__c,Status,Call_Stage__c,CreatedDate,Property_Possession_Date__c from Lead Where id=: LeadId LIMIT 1];
            string jsonString = data1.url__c; 
            String toSend = jsonString +'?PHONE='+l.MobilePhone+'&NAME='+l.Name+'&MAIL_ID='+l.Email+'&SOURCE='+l.Source__c+'&REGION='+l.City+'&CHANNEL='+l.Channel__c+'&LAST_MODIFIED_BY='+l.LastModifiedBy__c+'&LEAD_SOURCE='+l.DC_Lead_Source__c+'&CAMPAIGN_SOURCE='+l.DC_Campaign_Source__c+'&CREATE_DATE='+l.CreatedDate+'&PROJECT_NAME='+l.Project_Name__c+'&LEAD_ID='+l.LastModifiedDate+'&LEAD_STAGE='+l.Status+'&LEAD_STATUS='+l.DC_Lead_Status__c+'&CALL_STAGE='+l.Call_Stage__c+'&PP_DATE='+l.Property_Possession_Date__c+'&SF_LEAD_ID='+l.Id+'&DSA_Name='+l.DSAname__c+'&Followup_Date='+l.Follow_Up_Date_Time__c+'&Agent_Name='+l.Lead_Owner_Name__c;
            system.debug(toSend);
            HttpRequest req = new HttpRequest();
            HttpResponse res = new HttpResponse();
            Http http = new Http();
            req.setMethod('POST');
            req.setEndpoint(toSend);
            req.setTimeout(2000);
           res = http.send(req);
            System.debug(res);
      System.debug(res.getBody());
        }catch(Exception exc){
            
        }
       
    }
   
}
Below is my lead trigger code :

if(Trigger.isAfter && Trigger.isUpdate){
        if(Trigger.old[0].Status !='Converted' && Trigger.new[0].Status =='Converted'){
            LcsAPI.LCScallServer(Trigger.New[0].id) ;   
       }
   }  


 
<aura:component implements="flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" 
                access="global"
                controller="Getquotelcs">
    <aura:attribute name="recordId" type= "String"/>
    <aura:attribute name="ShowButton" type= "Boolean"/>
     <aura:attribute name="Isdisabled" type= "Boolean"/>
    <aura:handler name="init" value="{!this}" action ="{!c.doInit}"/>
    <aura:if isTrue = "{!v.ShowButton}">
        <lightning:card>
            <div class="slds-align_absolute-center">
        <lightning:button variant="brand" label="GetQuote" disabled = "{!v.Isdisabled}"  title="GetQuote" onclick="{! c.getQuote }" />
</div>
        </lightning:card>
    </aura:if> 
</aura:component>

CASE( Name , "Design Finalization", Project__r.Amount__c /20, "Complete Design Sign-off",Project__r.Amount__c /55 ,1).
This is my current formula, i want to change from that to this below :
Kindly help me out.


logic to calculate the milestone amount in the payment milestones:

If { milestone name = Design finalization, Milestone Amount == (Project value * 20%) - Opportunity's Invoice Amount;
Else If { Milestone name = Complete Design Sign-off, Milestone Amount == (Project value * 55%) - (Opportunity's Invoice Amount + Design Finalization's Invoice Amount);}
Else If {Milestone name = Factory Dispatch, Milestone Amount == Project value  - (Opportunity's Invoice Amount + Design Finalization's Invoice Amount+ Complete Design Sign-off's Invoice Amount);}}


Attributes:
Milestone name = Project__r.Name
Milestone Amount = EligibleAmount__c
Project Value: Project__r.Amount__c
Opportunity's Invoice Amount = Project__r.Opportunity__r.Amount  / 20
Design Finalization's Invoice Amount = Project__r.Total_Amount__c
Complete Design Sign-off's Invoice Amount = Total_Amount__c
Below is MY URL , am not able to do it from postman no response body.
but able to do it from work bench .

https://uat-tvsdesigncs74.force.com/services/apexrest/retriveAttachment?caseId=5000p000002bD1HAAU.

Kindly help me out if anyone knows thanks
test class :Milestone1_Project_Trigger_UtilityTest.
Method name :testHandleProjectDeleteTrigger.

this is the error :


System.DmlException: Delete failed. First exception on row 0 with id a062u000001PSZTAA4; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Project Milestone Template records are not allowed to be deleted from the system.: []
Stack Trace: Class.Milestone1_Project_Trigger_Utility.handleProjectDeleteTrigger: line 176, column 1 Class.Milestone1_Project_Trigger_UtilityTest.testHandleProjectDeleteTrigger: line 148, column 1.
public class LeadtoGenesys {
    @future(callout=true)
    public static void Callout(String LeadId){
       try{
            Leadtogenesys__c data1 = Leadtogenesys__c.getvalues('genesysapi');
            Lead l = [select id,Name,Email,MobilePhone,Source__c,Project_Name__c,Region__c,Channel__c,City,DC_Lead_Source__c,LastModifiedDate,Follow_Up_Date_Time__c,LastModifiedBy__c,DC_Campaign_Source__c,DSA__c,DSAname__c,Lead_Owner_Name__c,CreatedBy.id,DC_Lead_Status__c,Status,Call_Stage__c,CreatedDate,Property_Possession_Date__c from Lead Where id=: LeadId LIMIT 1];
            string jsonString = data1.url__c; 
            String toSend = jsonString +'?PHONE='+l.MobilePhone+'&NAME='+l.Name+'&MAIL_ID='+l.Email+'&SOURCE='+l.Source__c+'&REGION='+l.City+'&CHANNEL='+l.Channel__c+'&LAST_MODIFIED_BY='+l.LastModifiedBy__c+'&LEAD_SOURCE='+l.DC_Lead_Source__c+'&CAMPAIGN_SOURCE='+l.DC_Campaign_Source__c+'&CREATE_DATE='+l.CreatedDate+'&PROJECT_NAME='+l.Project_Name__c+'&LEAD_ID='+l.LastModifiedDate+'&LEAD_STAGE='+l.Status+'&LEAD_STATUS='+l.DC_Lead_Status__c+'&CALL_STAGE='+l.Call_Stage__c+'&PP_DATE='+l.Property_Possession_Date__c+'&SF_LEAD_ID='+l.Id+'&DSA_Name='+l.DSAname__c+'&Followup_Date='+l.Follow_Up_Date_Time__c+'&Agent_Name='+l.Lead_Owner_Name__c;
            system.debug(toSend);
            HttpRequest req = new HttpRequest();
            HttpResponse res = new HttpResponse();
            Http http = new Http();
            req.setMethod('POST');
            req.setEndpoint(toSend);
            req.setTimeout(2000);
           res = http.send(req);
            System.debug(res);
      System.debug(res.getBody());
        }catch(Exception exc){
            
        }
       
    }
   
}

CASE( Name , "Design Finalization", Project__r.Amount__c /20, "Complete Design Sign-off",Project__r.Amount__c /55 ,1).
This is my current formula, i want to change from that to this below :
Kindly help me out.


logic to calculate the milestone amount in the payment milestones:

If { milestone name = Design finalization, Milestone Amount == (Project value * 20%) - Opportunity's Invoice Amount;
Else If { Milestone name = Complete Design Sign-off, Milestone Amount == (Project value * 55%) - (Opportunity's Invoice Amount + Design Finalization's Invoice Amount);}
Else If {Milestone name = Factory Dispatch, Milestone Amount == Project value  - (Opportunity's Invoice Amount + Design Finalization's Invoice Amount+ Complete Design Sign-off's Invoice Amount);}}


Attributes:
Milestone name = Project__r.Name
Milestone Amount = EligibleAmount__c
Project Value: Project__r.Amount__c
Opportunity's Invoice Amount = Project__r.Opportunity__r.Amount  / 20
Design Finalization's Invoice Amount = Project__r.Total_Amount__c
Complete Design Sign-off's Invoice Amount = Total_Amount__c
Below is MY URL , am not able to do it from postman no response body.
but able to do it from work bench .

https://uat-tvsdesigncs74.force.com/services/apexrest/retriveAttachment?caseId=5000p000002bD1HAAU.

Kindly help me out if anyone knows thanks
test class :Milestone1_Project_Trigger_UtilityTest.
Method name :testHandleProjectDeleteTrigger.

this is the error :


System.DmlException: Delete failed. First exception on row 0 with id a062u000001PSZTAA4; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Project Milestone Template records are not allowed to be deleted from the system.: []
Stack Trace: Class.Milestone1_Project_Trigger_Utility.handleProjectDeleteTrigger: line 176, column 1 Class.Milestone1_Project_Trigger_UtilityTest.testHandleProjectDeleteTrigger: line 148, column 1.