• Rahul H 4
  • NEWBIE
  • 55 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 25
    Questions
  • 17
    Replies
We are receiving Opportunity from external system in date time format as 2019-09-03T00:06:00Z but when its trying to insert in Salesforce its throwing error.  be cause Salesforce expects created date time format as 2019-09-03T08:52:04.000Z. Can you please suggest how to achieve this? Thanks for your time. 
Can you please let me know how to create an email template for displaying Quote Line Items. I heard it can be done using Visual force page
I have to delete the Quote if Quote_Number__c in opportunity is equal to Quote_Number__c in Quotes. Can you please provide a sample trigger for that 
We have a custom object as Tracking Cases. There is a custom field as Case Number in Tracking Cases. We would do query on the Case Number and the logic should be able to fetch the Status and Dispatch Date from the Case entity.

Can you please help to get this achieved. Thanks 
When upserting Quote Line Item, We want to able to pass an external reference id which is a product code and have Salesforce determine the corresponding price book entry id. We only have one pricebook we are using and we can pass that in a custom field if required

Can you please let us know how to do that?
AND(
          ISPICKVAL(Warranty__c, "External"),
          OR(
                  ISBLANK(TEXT(Repairer__c)),
                  ISBLANK(NUMBER(Total_Price__c)),
                  ISBLANK(DATE(Invoice_Paid_Date__c)),

OR(
AND 

              ISPICKVAL(Warranty__c, "Internal"),
          OR(
                   ISBLANK(TEXT(Repairer__c)),
                   ISBLANK(NUMBER(Total_Price__c))
            )
))))

I am getting error as 
Error: Incorrect parameter type for function 'TEXT()'. Expected Number, Date, DateTime, Picklist, received Text

Need assistance
The button with the label “Activate Accounts”, when the User clicks the button “Activate Accounts”, the selected accounts should get the status Active = “Yes”.

The user also needs to get feedback about the successful update or any errors. The list should refresh after a successful update
Can you please help me to provide a trigger to Create Contact from Leads. Thanks 
We are looking to Create Quotes from Leads. The Quote is now added to Lead Related Lists. However, we dont see the New button. 
Can you please guide us how to create Quote from Leads. 
Pls help to write to query duplicate contacts in Salesforce
i wrote the query however it doesnt seem to work :(

Select Count(ID), Name From Contact Group BY Name Having Count(ID) > 1
I am looking to default account name as Citi in case entity everytime a new Case is created. need suggestions 
trigger Images34_case on Case (before insert, before update) {

list <string> name = new list<string>();
map<string,id> casemap = new map<string,id>();
for(case c : trigger.new){
name.add(c.Customer_Name__c );
}
for(contact con : [select id,name from contact where name in : name]){
casemap.put(con.name,con.id);
}
for(case ca: trigger.new){
if(casemap.containskey(ca.Customer_Name__c)){
ca.contactid = casemap.get(ca.Customer_Name__c);
}
}
}

this is my trigger.. can u pls help to write the classfor the same. thanks 
Contact name field is a validation rule as  
AND(ISCHANGED(Status), 
ISBLANK(ContactId))

I want to include name <> insta 

can u pls provide me correct syntax 
Hello,
I am looking to create a trigger to populate contact name (system field) with customer name in case entity.

trigger Images2_case on Case (before insert, before update) {
    for(Case c : Trigger.New) {
    string img = c.ContactId;

       if(ContactId=null){
 
               c.ContactId = Customer_Name__c;
        
        System.debug(img);
    }

    
    
}
}

however, its not working and giving error as Error: Compile Error: Condition expression must be of type Boolean: String at line 5 column 11

Can you please help. Thanks 
we don't have Duplicate Rules for Case entity. We are looking to Check Duplicate VIN and display error message as record with identical value exists. Can anyone please help. Thanks 
I want to create Invoices in Salesforce. Can you please help. Thanks 
I am facing a weird issue in Salesforce Production

Images text : www.intux.com.au/wp-content/uploads/gravity_forms/2-cb870933d1056667864f32a0efe9bcff/2018/10/DD37D32F-2C54-4B48-8A0D-49D549CDF9AA.jpeg 
www.intux.com.au/wp-content/uploads/gravity_forms/2-cb870933d1056667864f32a0efe9bcff/2018/10/BC591428-0FC7-4C01-AB72-94F70996162A.jpeg]

This was working before and was coming up as a hyperlink in Production wherein we just click the link and Images would open. But, with the new Salesforce release winter 19, its coming as rich Text so unable to open the Images

Its working fine in Sandbox though.

Can you please advise what has changed with the new Salesforce winter release and how to make tt work.

Thanks


 
Please help me to customize Error Messages for Invalid Approval Process? Thanks 
I want to display thumbnails in a field. 

Can you please help me. Thanks  
I want to query in Salesforce database for an inactive user to check if he is owning any records or not?
I tried to query in Salesforce data loader but it only queries on one entity at a time. Also, the same behavior is shown for Reports wherein one entity gets queried at a time. 

Please advise further. Thanks
AND(
          ISPICKVAL(Warranty__c, "External"),
          OR(
                  ISBLANK(TEXT(Repairer__c)),
                  ISBLANK(NUMBER(Total_Price__c)),
                  ISBLANK(DATE(Invoice_Paid_Date__c)),

OR(
AND 

              ISPICKVAL(Warranty__c, "Internal"),
          OR(
                   ISBLANK(TEXT(Repairer__c)),
                   ISBLANK(NUMBER(Total_Price__c))
            )
))))

I am getting error as 
Error: Incorrect parameter type for function 'TEXT()'. Expected Number, Date, DateTime, Picklist, received Text

Need assistance
The button with the label “Activate Accounts”, when the User clicks the button “Activate Accounts”, the selected accounts should get the status Active = “Yes”.

The user also needs to get feedback about the successful update or any errors. The list should refresh after a successful update
Can you please help me to provide a trigger to Create Contact from Leads. Thanks 
We are looking to Create Quotes from Leads. The Quote is now added to Lead Related Lists. However, we dont see the New button. 
Can you please guide us how to create Quote from Leads. 
trigger Images34_case on Case (before insert, before update) {

list <string> name = new list<string>();
map<string,id> casemap = new map<string,id>();
for(case c : trigger.new){
name.add(c.Customer_Name__c );
}
for(contact con : [select id,name from contact where name in : name]){
casemap.put(con.name,con.id);
}
for(case ca: trigger.new){
if(casemap.containskey(ca.Customer_Name__c)){
ca.contactid = casemap.get(ca.Customer_Name__c);
}
}
}

this is my trigger.. can u pls help to write the classfor the same. thanks 
Hello,
I am looking to create a trigger to populate contact name (system field) with customer name in case entity.

trigger Images2_case on Case (before insert, before update) {
    for(Case c : Trigger.New) {
    string img = c.ContactId;

       if(ContactId=null){
 
               c.ContactId = Customer_Name__c;
        
        System.debug(img);
    }

    
    
}
}

however, its not working and giving error as Error: Compile Error: Condition expression must be of type Boolean: String at line 5 column 11

Can you please help. Thanks 
I have written the Apex trigger for Case entitlement.
 
trigger DefaultEntitlement on Case (Before Insert, Before Update) {
List<Id> contactIds = new List<Id>();
List<Id> acctIds = new List<Id>();
for (Case c : Trigger.new){
if ( c.EntitlementId == null && c.ContactId != null && c.AccountId != null){
contactIds.add(c.ContactId);
acctIds.add(c.AccountId);
}
}
system.Debug('acctIds'+acctIds);
system.Debug('contactIds'+contactIds);
List <EntitlementContact> entlContacts =
[Select e.EntitlementId,e.ContactId,e.Entitlement.AssetId
From EntitlementContact e
Where e.ContactId in :contactIds
And e.Entitlement.EndDate >= Today
And e.Entitlement.StartDate <= Today];
if(entlContacts.isEmpty()==false){
for(Case c : Trigger.new){
if(c.EntitlementId == null && c.ContactId != null){
for(EntitlementContact ec:entlContacts){
if(ec.ContactId==c.ContactId){
c.EntitlementId = ec.EntitlementId;
if(c.AssetId==null && ec.Entitlement.AssetId!=null)
c.AssetId=ec.Entitlement.AssetId;
break;
}
}
}
}
} else{
List <Entitlement> entls = [Select e.StartDate, e.Id, e.EndDate,
e.AccountId, e.AssetId
From Entitlement e
Where e.AccountId in :acctIds And e.EndDate >= Today
And e.StartDate <= Today];
if(entls.isEmpty()==false){
for(Case c : Trigger.new){
if(c.EntitlementId == null && c.AccountId != null){
for(Entitlement e:entls){
if(e.AccountId==c.AccountId){
c.EntitlementId = e.Id;
if(c.AssetId==null && e.AssetId!=null)
c.AssetId=e.AssetId;
break;
}
}
}
}
}
}
}
 
The Apex trigger is fine and no syntax issues are surfaced. But, the code coverage is only 444% so I am trying to write the Apex Test Class..
 
 
@isTest
private class MilestoneTest {
 
static testMethod void TestCompleteMilestoneCase(){
 
List<Account> acts = new List<Account>();
Account myAcc = new Account(Name='TestAct', phone='1001231234');
acts.add(myAcc);
 
Account busAcc = new Account(Name = 'TestForMS', phone='4567890999');
acts.add(busAcc);
insert acts;
Contact cont = new Contact(FirstName = 'Test', LastName = 'LastName', phone='4567890999', accountid = busAcc.id);
insert(cont);
 
Id contactId = cont.Id;
 
Entitlement entl = new Entitlement(Name='TestEntitlement', AccountId=busAcc.Id);
insert entl;
 
String entlId;
if (entl != null)
entlId = entl.Id;
 
List<Case> cases = new List<Case>{};
if (entlId != null){
Case c = new Case(Subject = 'Test Case with Entitlement ',
EntitlementId = entlId, ContactId = contactId);
cases.add(c);
}
if (cases.isEmpty()==false){
insert cases;
List<Id> caseIds = new List<Id>();
for (Case cL : cases){
caseIds.add(cL.Id);
}
milestoneUtils.completeMilestone(caseIds, 'First Response', System.now());
}
}
}
 
But, it seems to have some problem.
 
Can you please check and advise.
 
Thanks
 
I am using a VisualForce page that searches for an object within a different web-based system and displays it on the record page in SF.  In my case, it is pulling the object ID in SF and passing that to the other site and searching for a record that matches this ID.  The problem I have is that in my other system I am using the 15 digit IDs but the VF page is using the 18 digit ID so it is not finding what I am looking for.  Here is my markup I am using:

<apex:page standardController="Account" title="Workspace corresponding to an account">
  <apex:iframe scrolling="true" title="Account Workspace" src="<WEBSITE URL?sfSession={!$Api.Session_ID}&sfUrl={!$Api.Partner_Server_URL_70}&smallDisplay=Y&ws={!URLENCODE(account.id)}"/>
</apex:page>

When I look in the URL of the object page I see this ID:

001G000001WraVp

But my VF page is passing this ID:

001G000001WraVpIAJ

I know about the CASESAFEID formula operator that will convert the 15 digit ID to the 18 digit but I am sort of looking for the opposite.  Or if there is a way that I could truncate the ID down to 15 or something that also might work.  I realize that it would be better to use the 18 digit IDs in my other system but I already have a lot of data there and it would be a ton of work to go and change it at this point.  Any Ideas?  I am not real savvy on this stuff yet so go easy on me :)


Hi I have written a trigger that will update a field on Account when the child record is created or the first child records (on Account) will get updated. However, my test class is failing on the de-refence a null object and I'm getting 91% coverage. how? 

Error Message:

System.DmlException: Upsert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, NewJobTimeStampOnAccount: execution of AfterInsert

caused by: System.NullPointerException: Attempt to de-reference a null object

Trigger.NewJobTimeStampOnAccount: line 22, column 1: []

Trigger:
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
trigger NewJobTimeStampOnAccount on Job__c (after insert, after update) {

  Map<ID, Account> parentAcct = new Map<ID, Account>(); //Making it a map instead of list for easier lookup
  List<Id> listIds = new List<Id>();
 
if(trigger.isInsert || trigger.isUpdate){
  for (Job__c childObj : Trigger.new){
    listIds.add(childObj.Account__c);
  }
}
  //Populate the map. Also make sure you select the field you want to update, amount
  //The child relationship is more likely called jobs__r (not job__r) but check
  //You only need to select the child jobs if you are going to do something for example checking whether the job in the trigger is the latest
  parentAcct = new Map<Id, Account>([SELECT id, New_Job_Start_Date__c, (SELECT ID, Date_Time_Taken__c FROM Jobs__r) FROM Account WHERE ID IN :listIds]);
 
  List<Job__c> i = [select id from Job__c where Account__c in :listIds order by Date_Time_Taken__c ASC limit 5];

  for (Job__c job: Trigger.new){
     if(i[0].id == job.id)
     {
        Account myParentAcct = parentAcct.get(job.Account__c);
        myParentAcct.New_Job_Start_Date__c = job.Date_Time_Taken__c;
       
     }
  }
  update parentAcct.values();

}

Test class:

@isTest
private class NewJobTimeStampOnAccount_Test {

    static testmethod void test_trigger(){
     
        Job__c job = new Job__c(Job_Name__c = 'Roy,Semira tes', Date_Time_Taken__c = datetime.now(), contact__c = '003S000000m4qD5', Account__c = '001S000000gq5Dp', Project_manager__c = '00570000002rgiK', name = '6##-##-02206', Stage__c = 'Qualification', Status__c = 'Opportunity', Office__c = 'Chicago', Lead_Source__c = 'Agent', Job_class__c = 'Apartment', County__c = 'Orange', City_of_LA__c = 'No');
      
        upsert job;
      
    }
}