• Raj2019ss
  • NEWBIE
  • 120 Points
  • Member since 2018

  • Chatter
    Feed
  • 3
    Best Answers
  • 0
    Likes Received
  • 2
    Likes Given
  • 6
    Questions
  • 28
    Replies
if I change stage name in opportunity then automatically Date field(custom field) should be updated with current date using workflow?
hi all,
My Task is to change the due date or closed date of opportunity records under account object 
1st opportunity record to 75 days == created date + 75 days
2nd and 3rd or more to 180 days == created date +180 days



thanks in advance...
  • May 02, 2018
  • Like
  • 0
Hello all,
I'm an admin trying to customize some code I found and it works - yet I got a comment that it is not bulkified.
The code looks at the probability of the opportunity - if it is 10% or over AND the field updated on the opportunity is the probability % field, the trigger should fire and update the date field SQLDate__c under each one of the contact ( Contact Roles).
I also would like it to update the SQLDate__c field only if it is null.

Can you suggest how to bulkify such code and if I used the correct expression (bolded) to make sure that the date will be updated only if the field is null?

Any suggestions to optimize the code are very welcome as well.

Thank you!


trigger UpdateContact on Opportunity (after insert, after update) {

        OpportunityContactRole ocr;
        Contact contact;
        Opportunity opp = Trigger.new[0];
        list<Contact> listToUpdate = new list<Contact>();
        if(opp.Probability >= 10 && opp.Probability !=trigger.oldMap.get(opp.id).Probability){

            for(OpportunityContactRole iterating_oppConRole : [SELECT o.Role, 
                                                                      o.OpportunityId, 
                                                                      o.IsPrimary, 
                                                                      o.Id, 
                                                                      o.ContactId,
                                                                      o.Contact.SQLDate__c 
                                                              FROM OpportunityContactRole o where o.OpportunityId =: opp.id])
                                                              {
                Contact tempContact = new Contact(id=iterating_oppConRole.ContactId, SQLDate__c = system.today());
                if( tempContact.SQLDate__c == null){
                listToUpdate.add(tempContact);
                }
                
           }
        }
       
        if(!listToUpdate.isEmpty())
            update listToUpdate;
}
  • May 01, 2018
  • Like
  • 0
In process builder, using formula entry criteria i have checked ISPICKVAL([Order.StatusCode], 'A') and i'm updating one picklist field in update actions. its worked fine that time and will moved to production. After refreshing the sandbox, the same Process builder not worked in Production. Then I have changed ISPICKVAL([Order.StatusCode], 'Activated'). Its working fine now.
My question here is
1. Is this get vary to production and Sandbox? OR
2. Is it due to org release version like spring 19 etc
I tried to found document but not getting any relevant documents. Please can anyone give your comments if you have faced any issues like above. And if you find any relevant docs.

Thanks
Hi all,
I'm trying to fetch Xero Payments using set of payment ids. But I'm getting all payments instead of getting particular payments.
thisRequest.setEndpoint('https://api.xero.com/api.xro/2.0/Payments?ids='+paymentIds);
in the paymenIds i'm having 2 for example.

If you have any idea pls suggest me in the correct way.

Thanks!
 
repport
I'm getting below error,
User-added image
Please anyone say the solutions to fix the issues.

Thanks
what settings can be transferred threw metadata api
          web to case 
          web to lead
          case settings
          lead conversion
Please let me know the answer for the above question?
Hi All,

I'm having Custom Standard User Profile with having read/write access for opportunity and campaign.
while selecting Primary Campaign Source in Opportunity I'm getting below error
"Insufficient access to selected object Id"
Please suggest any solutions.

thanks 
Hi Developers,
I have installed Adobe Sign package into my Org. If I click "Adobe Sign Admin", its shows Login Page. After successfully logged into Adobe sign but the page still loading. After refreshing the page its again comes into the login page.

Any ideas how to integrate?

User-added image
repport
I'm getting below error,
User-added image
Please anyone say the solutions to fix the issues.

Thanks
I am  using custom metadata would what custom field i should create while using custom metadata? and how i can call in trigger

Here is my requirment...

I am creating caseemail record  for cetain case status and record type ,i have create record for satus and record type combitions. Also after creating a record i need to set on filed case notificatios = some value.

Currently i created  recordtype name, record type id ,status and notification field,but not sure how i can use tis fileds in my code , can you please give me some idea on that.

Thanks in Advance
what settings can be transferred threw metadata api
          web to case 
          web to lead
          case settings
          lead conversion
Please let me know the answer for the above question?
Hi All,

I'm having Custom Standard User Profile with having read/write access for opportunity and campaign.
while selecting Primary Campaign Source in Opportunity I'm getting below error
"Insufficient access to selected object Id"
Please suggest any solutions.

thanks 
Hi Expert

I want to update Lead object field by child object of Lead, but i am not able to get relation.

Please suggesy
I have a requirement to count the number of opportunity line items and populate it to the account.
I was thinking to use Aggregate queries,but is it poosible to do it using this.
I am in process of creating this however i am stuck:

public with sharing class opportunityTriggerHandlerClass {
    public static void countofOliItemsMethod(List<OpportunityLineItem> oliList){
        Set<Id> oppIdSet = new Set<Id>();
        Set<Id> accIdSet = new Set<Id>();
        for(OpportunityLineItem oli: oliList){
            oppIdSet.add(oli.OpportunityId);
        }
        for(Opportunity oppty : [SELECT ID,AccountId FROM Opportunity WHERE Id IN: oppIdSet]){
             accIdSet.add(oppty.AccountId) ;
        }
        List<AggregateResult> aggr = [SELECT OpportunityId,Opportunity.AccountId,Opportunity.Account.Name,count(Id)oli FROM               

                                                          OpportunityLineItem 
                                                          WHERE Opportunity.AccountId IN:accIdSet GROUP BY Opportunity.AccountId] ;
    }
}

I face an error that "Field must be grouped or aggregated: OpportunityId".

Can anybody tell me how should we approach here.

Thanks in advance!
I am attempting to update a visualforce email template based on conditional formatting. I only want the field "Training Room" to be in the email template if there is data in the Training_Room__c field. If it is null, then I do not want the training room data pulled in anywhere.

Right now, it's always pulling Training_Room__c. See below:

<apex:outputPanel rendered="{!relatedTo.Training__r.Training_Type__r.Virtual_Training_Type__c = false}">
    <b>Time:</b> {!relatedTo.Training__r.Training_Type__r.Time__c}<br/>
</apex:outputPanel>
<apex:outputPanel rendered="{!relatedTo.Training__r.Training_Type__r.Virtual_Training_Type__c = true}">
    <b>Time:</b> {!relatedTo.Training__r.Virtual_Start_and_End_Time__c}<br/>
</apex:outputPanel>
    <b>Training Room:</b> {!relatedTo.Training__r.Training_Room__c}<br/>
if I change stage name in opportunity then automatically Date field(custom field) should be updated with current date using workflow?
Hello All,

I am looking for a functionality wherein I am creating an opportunity from the event. The condition is that the oppty will only be created when the Event-Type is Demo and the Status ( a custom picklist field on the Event) = Complete.
I have created a trigger to achieve this requirement. Below is the code:

trigger EventTrigger on Event (after update){

    List<Opportunity> opportunities = new List<Opportunity>();
    List<Id> idAccountList = new List<Id>();
    List<Event> eventToProcessList = new List<Event>();
    String eventType;
    
    for(Event event :Trigger.new) {

        eventType = event.Type;
        if(!eventType.containsIgnoreCase('demo') || eventType.Demo_Status__c != 'Completed') continue;

        if(event.WhatId.getSObjectType() != Account.SObjectType) continue;
        
        idAccountList.add(event.WhatId);
        eventToProcessList.add(event);
        
    }
    
    if(idAccountList.isEmpty()) return;
    
    Map<Id, Account> accountMap = [SELECT Id, Name FROM Account WHERE Id IN :idAccountList];
    
    for(Event event : eventToProcessList){
        
        Opportunity opp = new Opportunity(
            Name = accountMap.get(event.WhatId).Name + '|RP|' + event.Seats__c,
            //Name = 'Test Opp'+ 'Amount'+'(event.Id).Contact_Lookup__c',
            CloseDate = Date.Today()+ 90,
            Type = 'New Business',
            //Notes__c = Trigger.newMap.get(event.Id).Notes__c,
            Notes__c = event.Notes__c,
            //fill other mandatory fields comma seperated as shown above
            AccountId = event.WhatId,
            //Contact_Lookup__c = Trigger.newMap.get(event.Id).Contact_Lookup__c,
            StageName = 'Pre-Qualified',
            Referring_SDR__c= event.OwnerId,
            Contact_Name__c = event.Related_Contact_Name__c,
            Opportunity_Owner__c= event.Assigned_AE__c,
            Amt__c= event.Amount__c,
            Seat_Number__c= event.Seats__c,
            LeadSource= event.Lead_Source__c,
            New_Lead_Source__c= event.New_Lead_Source__c
         );
         opportunities.add(opp);
    }

    if(!opportunities.isEmpty()){
        insert opportunities;
    }
}

But I am getting the below compile error:
" Error: Compile Error: Variable does not exist: Demo_Status__c at line 11 column 63 "
Not sure why this is coming as the API name is correct as per my knowledge.

Also, additionally I am looking to map this event to the opportunity that gets created via trigger for this event on the basis of EventId/ActivityId so that we can create a report to track the number of events that got converted into opportunities.

Any quick help will be highly appreciated.  Thanks in advance!
Hi all ,
My requirment is to create sort order for tasks .........
the tasks are created when opportyunity record is created ........
Example : 3)Task3  but i want output has 1)Task1, 2)Task2, 3)Task3  in order
                 2)Task2
                 1)task1
My code :
public class CompsureTasks_helper{
    //Create tasks
    public static void createTasks(List<id> oppId){
    List<Opportunity> oppList = [select id,name,closedate,ownerid,Opportunity_Period__c from Opportunity where id IN : oppId];
    List<Task> insertTasks = new List<Task>();
    for(Opportunity opp : oppList){
    //for Task1
        task t = new task(OwnerId = opp.ownerid,Subject = 'Task1',Status = 'Open',Priority = 'Normal',WhatId = opp.Id);
           integer tt = (integer)Math.round((15*opp.Opportunity_Period__c)/100);
           system.debug('$$$'+tt);
           t.activitydate = system.today().adddays((integer)Math.round((15*opp.Opportunity_Period__c)/100));
           t.IsReminderSet = true;
           t.ReminderDateTime = t.activitydate;  
        insertTasks.add(t);
    //For Task2   
        task t1 = new task(OwnerId = opp.ownerid,Subject = 'Task2',Status = 'Open',Priority = 'Normal',WhatId = opp.Id);
            t1.activitydate = system.today().adddays((integer)Math.round((20*opp.Opportunity_Period__c)/100));
            t1.IsReminderSet = true;
            t1.ReminderDateTime = t1.activitydate;  
        insertTasks.add(t1);
      
    //For Task3   
        task t2 = new task(OwnerId = opp.ownerid,Subject = 'Task3',Status = 'Open',Priority = 'Normal',WhatId = opp.Id);
            t2.activitydate = system.today().adddays((integer)Math.round((25*opp.Opportunity_Period__c)/100));
            t2.IsReminderSet = true;
            t2.ReminderDateTime = t2.activitydate;  
        insertTasks.add(t2);
        
   
    }
    insert insertTasks;
    }
    }
  • May 10, 2018
  • Like
  • 0
how can i add context  ,i am using vf page to link User-added image what can i do 
hi all,
My Task is to change the due date or closed date of opportunity records under account object 
1st opportunity record to 75 days == created date + 75 days
2nd and 3rd or more to 180 days == created date +180 days



thanks in advance...
  • May 02, 2018
  • Like
  • 0
Experts Response Required on below questions

1- If you have a standard controller and a custom extension, in Visual Force page and you have save(Action) method defined in extension as well. If we put {!save} in our VF page, what will happen
a- Both save action methods from standard and extension will be executed one by one ?
b- Only extension Save action will execute?
c- Only standard controller Save action will execute?

2- Bulk orders imported to Salesforce. If we want to match email field against contact and opportunity then what will be the best approach to do it
a- Workflow
b- process builder
c- Apex

3- With which on these options can we run tests
a- MetaData API
b- Bulk API
c- Tooling API

4- Can we use InlineCSS in salesforce visual force page?

5- If we have SelectOptions tag in visualforce page and we only want to display the selected option data in page, what can be the best approach
a- using custom controller with data in lists for each option?
b- on page rendering

6- If you have lightening component with a list of account.How can you enable havor for it?

7- if you have a related field compnaignmanager in Lead object. and when you convert Lead to new Account.Opportunity,contact then where will the compaignmanager will show as Lookup field
a- Account
b- Opportuntiy
c- contact

8- What is the SOQL command to be used for controlling SQL injections?

9- To access owner from accounts object in a visual force page(Standard controller = contact), use {!contact.account.owner}. True/False?

10- What is the best approach to display list of account on a VF page.
a- Extension Controller
b- List Controller
c- Custom Controller
hi all i am loooking to  write a pd1 certification this weekend can anyone share the latest dumps.
my email id :banapuramshravankumar@gmail.com
Thank you