• ajinkya shahane 1
  • NEWBIE
  • 15 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 4
    Replies
I have one Custom Object named as Contact Relationships in which contacts are mapped.
it is mapped with account and opportunity object
when particular account want to mapp the contact relationship it will call the visual force page having following fields

Account  - Lookup
Contact  - Lookup
Relationship type - picklist
Inactive Relationship - checkbox

When we fill up all this fields say Contact Record XYZ is saved with relatioship type YYy

again If i want to create contact relatioship of same contact with diffrent relationship type

So for contact I will have muliple records stating diffrent relatioship type and inactive relationship type

I want to merge this multiple records for single contact into single record with showing the relationship type and Inactive relationship type check box

Please suggest
Hello All,

I am trying to write a trigger and getting this error.
 here's the code -

Trigger LastOnsiteVisit_SA on Event(Before insert, before update) {
 Set<ID> eventIds = new Set<ID>();
 Set<ID> AccountIDZ = new Set<ID>();

 for (Event evt: Trigger.New) {

  eventIds.add(evt.Id);

  AccountIDZ.add(evt.AccountId);
 }

 Set<Account> Accountset = new Set<Account>([SELECT ID FROM Account where ID IN: AccountIDZ]);

 Map<Id,DateTime> mp2 = new Map<Id,DateTime>([SELECT AccountId, EndDateTime FROM Event WHERE RecordTypeId = '01270000000YSks'
                                              AND AccountId IN :AccountIDZ
                                              AND Type = 'Onsite Meeting'
                                              ORDER BY EndDateTime DESC]);
    
 for (Account acct: Accountset) {
  if (mp2.containskey(acct.id)) {
   acct.Last_Onsite_Visit__c = mp2.get(acct.Id).Date();

  }
 }
}
Hello All,

I am trying to write a trigger and getting this error.
 here's the code -

Trigger LastOnsiteVisit_SA on Event(Before insert, before update) {
 Set<ID> eventIds = new Set<ID>();
 Set<ID> AccountIDZ = new Set<ID>();

 for (Event evt: Trigger.New) {

  eventIds.add(evt.Id);

  AccountIDZ.add(evt.AccountId);
 }

 Set<Account> Accountset = new Set<Account>([SELECT ID FROM Account where ID IN: AccountIDZ]);

 Map<Id,DateTime> mp2 = new Map<Id,DateTime>([SELECT AccountId, EndDateTime FROM Event WHERE RecordTypeId = '01270000000YSks'
                                              AND AccountId IN :AccountIDZ
                                              AND Type = 'Onsite Meeting'
                                              ORDER BY EndDateTime DESC]);
    
 for (Account acct: Accountset) {
  if (mp2.containskey(acct.id)) {
   acct.Last_Onsite_Visit__c = mp2.get(acct.Id).Date();

  }
 }
}