• Waqar Hussain SF
  • PRO
  • 3362 Points
  • Member since 2014
  • Certified Salesforce Developer
  • EinsTeam LLC


  • Chatter
    Feed
  • 104
    Best Answers
  • 2
    Likes Received
  • 12
    Likes Given
  • 21
    Questions
  • 798
    Replies
AND( 
OR ( 
(OwnerId = '0050K000008w8dA'), 
(OwnerId = '00528000003hxZN')), 
EndDate = Today()    
)

Hi All,

I have created a time trigger workflow to notify campaign owners (few listed users) once the campaign is ended after 1 days and final notification after 3 days.
- This is the workflow condition :
- created, and any time it's edited to subsequently meet criteria 
-Workflow formula :
AND( 
OR ( 
(OwnerId = '0050K000008w8dA'), 
(OwnerId = '00528000003hxZN')), 
EndDate = Today()    
)

- Then created time trigger: 1 - Days - After - Campaign: EndDate 
- One more time trigger created for 3 days final notification.
- Then Workflow Action - New Email Alert - Added the template and selected  Owner in the Recipient Type.

I created a test campaign with End date today and checked the time-based workflow under Monitor and when I search with the workflow name it's showing up the Scheduled notification time. 

My concern is : 
-Will the existing campaign trigger if the end date reaches today, without a campaign being edited? If no, can you please suggest?
-There is a time lag between countries, how will the notification go time zone is different?

Thanks for your Help!!

 


 
Hi Team,

I have generated a report on Opportunity with same filter condition, for this filter i am using below soql query. But Report and developer cosole fetching different records (Records mismatch ).

SOQL Query :
----------------------
Select id,Name from Opportunity WHERE (Category__c = 'Red Zone / Awarded, Negotiating Contract' OR  Category__c = 'Top Pursuits' OR  Category__c ='Cultivation Targets')
 AND (Region__c != 'Portfolio Services' OR Region__c !='KLMK' OR Region__c != 'Competitors ')
 AND Top_10__c = 'Yes'
 AND (Pursuit_Type__c ='New' OR Pursuit_Type__c ='Expansion' OR Pursuit_Type__c ='Renewal' OR Pursuit_Type__c ='Extension')
 AND (NOT Name Like '%Dummy%')
Report Filter  :
------------------------
Filtered By:   Edit 
   	Category equals "Red Zone / Awarded, Negotiating Contract",Top Pursuits,Cultivation Targets Clear 
   	AND Selling Team not equal to Portfolio Services,KLMK,Competitors Clear 
   	AND Growth Report Pursuit equals Yes Clear 
   	AND Pursuit (Type) equals New,Expansion,Renewal,Extension Clear 
   	AND Opportunity Name does not contain Dummy Clear

Please let me know any one......
How can we resolve this issue...

 
Hi, I have a use case.I have three objects Student,Account and Contact."Student is parent to Account and Account is  parent to Contact.When ever i update Tenure field in contact,Students "Tenure" field should also be updated.I am having issues wth code.When I am tring to update a field in contact this isthe error, I am getting.<<< ERROR :    Review the following errors
StudentTenure: execution of AfterUpdate caused by: System.DmlException: Update failed. First exception on row 0; first error: MISSING_ARGUMENT, Id not specified in an update call: [] Trigger.StudentTenure: line 14, column 1 :>>>

Program:

trigger StudentTenure on Contact (After Update) {
    List<Student__c> stulst = new List<Student__c>();
    List<Contact> cst = new List<Contact>();
    cst = [SELECT id,Name,Tenure__c,Account.Student__r.Tenure__c FROM Contact WHERE id IN :Trigger.old];
    System.debug('Data is cst: '+cst);
    for(Contact c : cst){
    
        Student__c s = new Student__c();
        if(c.Tenure__c == 'OLD'){
            s.Tenure__c = 'OLD';
        }
        stulst.add(s);
    }
    update stulst;
}

 
Hello, I'm a newbie to the Salesforce platform. 
Can anybody say why we can not use "int" in "for" clause and we have to use Integer in it?
for example 
for (Integer i = 0 ; i < 200; i++) { ... } is correct but 
for (Integer i = 0 ; i < 200; i++) { ... }  is wrong.
Hi,

Can someone explain this question to me? The web site where I found this question states the answer as 0 orders will be successfully loaded, but I didn't understand why.   Is it because the governor limit on the number of SELECTs is 100?

Thank you.
Priya

List<Account> customers = new List<Account>();
For (Order__c o: trigger.new)
{
Account a = [SELECT Id, Is_Customer__c FROM Account WHERE Id = :o.Customer__c];
a.Is_Customer__c = true;
customers.add(a);
}
Database.update(customers, false);
The developer tests the code using Apex Data Loader and successfully loads 10 Orders. Then, the developer loads 150 Orders.
How many Orders are successfully loaded when the developer attempts to load the 150 Orders?
We are in lightning using actions to create an event.

A user is allowed to enter a start date in the past. When a user does this, the end date stays today and does not automatically change to the date of the start date. So if today is 6/26/2018 and the user enters a day in the past as the start date, they want the end date to automatically be that date int eh past as well after saving.

They are allowed to enter dates in the past so a validation rule is out. In a WFR I can not see how to use the end daste in the criteria. I tried process builder and it does not seem to be firing when using an action in Lightning. 

Is this possible in lightning or just yet another limitation?
Hello,
I am failing to pass the challenge in Admin Intermediate > Formulas & Validations > Create Validation Rules.
I get the following error:
"Challenge not yet complete... here's what's wrong:
There was an unexpected error in your org which is preventing this assessment check from completing: System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Contact must be in Account ZIP Code: []"
Here is the setting for my validation formula:
User-added image
Can someone help me?
Thanks in advance.
Jacques
 
Hello Expert Team
Can you please advise how do I merge two Profiles in my org. 
The requirement is :
Profile A to be Merged with Profile B and renamed as XYZ. And all the Users to be moved to the surviving Profile..(XYZ)
Appreciate any guidance. 
public class my_extension {   
    public TCOM__c t;
    ApexPages.StandardController sController;
    
    public my_extension(ApexPages.StandardController controller) {
        sController = controller;
        t= (TCOM__c )controller.getRecord();
    } 
    
    public ApexPages.PageReference saveNew(){
        sController = new ApexPages.StandardController(t);
        PageReference p=null;
        try{
            sController.save();
            p=new PageReference('/apex/vf40');
            p.setRedirect(true);
        }
        catch(Exception e) {
            return null;
        }
        return p;
        
    }
}

Hi! Attempting to solve this trailhead project, but the following error was received.

User-added image

Can you help me, please?

Hello, 

I'm using the Order Object and create a discount field on my order item. 
When I gave a discount on item, I need that my Total Amount Field, on my Order, be updated. 
Is There anyway to update a standard formula field?

 
Hi, I have a VF page that show 'Similar Leads' based on matching by email. Because in our org it is okay to have the same lead twice as they could be for different events. Any way I have a VF page with apex class that shows the 'similar leads'. Howvwer this just shows the leads, doesnt allow you to edit them. Can you suggest how this could be done? Code below:

Apex: 
public class GetLeadsApexController {
    private final Lead lead;
    
    public GetLeadsApexController(ApexPages.StandardController stdController) {
        if (!Test.isRunningTest()) {
            stdController.addFields(new List<String>{'Name', 'Email', 'OwnerId', 'Status', 'Product_of_Interest__c'});
        }
        this.lead = (Lead)stdController.getRecord();
    }

    public List<Lead> getLeads () {             
        List<Lead> leads = [
            SELECT Id, Name, Email, Status, OwnerId, Product_of_Interest__c FROM Lead WHERE Id != :lead.Id AND Email = :lead.Email
        ];
        return leads;
    }
}

VF Page:
<apex:page lightningStylesheets="true" standardController="Lead" extensions="GetLeadsApexController" tabStyle="Lead" sidebar="false">
 <apex:pageBlock >
          <apex:pageBlockTable value="{! leads }" var="ct" id="leads_list">
            <apex:column value="{! ct.name}" />
            <apex:column value="{! ct.email}" />           
            <apex:column value="{! ct.Product_of_Interest__c}" />
            <apex:column value="{! ct.OwnerId}" />
            <apex:column value="{! ct.Status}" />
            <apex:inputCheckbox />
          </apex:pageBlockTable>    
      </apex:pageBlock>
</apex:page>


Many Thanks
Conor
 

Hi All,

I have two queries find it as follows:

String partid;
String proId;
id ProcessId = ApexPages.currentPage().getParameters().get('id');
proId = [select id,part__c,part_id__c from process_sheet__c where id=:ProcessId].Id;
partid = [select id,part__c,part_id__c from process_sheet__c where id=:ProcessId].part_id__c ;
att=[Select a.Id,a.ContentType,a.ParentId,a.Parent.Type,a.Parent.Name,a.BodyLength From Attachment a where  a.parent.Id=:partid ];
attch = [Select a.Id,a.ContentType,a.ParentId,a.Parent.Type,a.Parent.Name,a.BodyLength From Attachment a where  a.parent.Id=:proId ];
Now I need a result where parent.Id matches with both proId and partid. Please help me!!!

Thanks in advance 


    

I've created a custom object with related custom fields. I've also created an Apex Trigger to roll up data into said custom object. We tested it in production and we have 95% coverage. When I go to validate through the inbound change set, it says I have 0% coverage. How can this be? I've checked in both the developer console test and in classes (an apex class was created as well). What am I doing wrong? I've looked at the other forums and can't find an answer. Thanks in advance
Hi All
I have some amount of Case object Custom page layouts and I have create the exact replica of the same using Lightning App Builder
I pulled hightlights panel, record detail page, related list 

I face the following issues
I'm not able to have sharing button on the HIGHLIGHTS PANEL,
I'm not able have the Solutions in the Related List 
Though I have included fields in Compact Layout, few fields are missing in the highlight panel

I'm totally new to Lightning pls help 

User-added image
HI, 

Sorry for such a basic question but I just wanted to confirm that as an enterrise edition company our users are entitled to use the trailhead courses without any extra cost ? 

Cheers

Graham
When I mark a resume__c as Active(picklist value).
All the applications for this candidate should be updated with the current resume(Current is picklist  value on Application__c)
(Exsiting records should also be updated if above scenario will be match)
Parent--- Resume
Child--- Application
Resume__c and Application__c are Child of Candidate__c
 

Hi,

I am using the hiSoft ContactRolesRequired package, but it is not working properly when cloning opps. Cloning does not carries the contact role, but still triggers on edit screen, which does not allow to add contact role. 

Any solutions you can suggest?

I am trying to auto populate a lookup field using an apex trigger and could use some help. My case only uses opportunity objects. On each opportunity there are 2 lookup fields. Example: Once lookup_field_A on Opp1 gets filled with Opp2, I would like to fill Opp2's lookup_field_B with Opp1. 

I've started writing this code out but I'm unsure how to grab Opp2 from lookup_field_A and then set lookup_field_B to be Opp1.

Anyone have any ideas? Any insight would be helpful.
I am trying to learn apex and not understanding when to use "final" modifier . How does it differ from "static"?
appreiate your help!
  • May 30, 2018
  • Like
  • 0
On the lead object, I have setup a process builder which have a Post to Chatter is sending chatter post to salesfore user (custom user lookup field on lead object).

It works fine when I select salesforce internal user in the lookup. But when I select salesforce community portal user in th lookup, I get error in the process builder failure email which says "The record for this post was deleted"
No more information is provided in the email. I see the portal user has Read/Write access to that lead record.

Can any one know the cause of this error?
Hi All,

Hope you will be fine. 

We have developed REST webservices in Salesforce and then calling these APIs from External system (Wordpress/PHP) using OAuth 2.0. We have created an app in salesforce as required.

We are encountring an issue that sometimes our access token get expired. We are unable to find that why the access token is expiring. Sometime access token expires within a day and sometime the access token works for couple of weeks.

You can see my app setting in Salesforce. 
User-added image

REST App setting in Salesforce
User-added image

I read some articles where it is said that the access token expires based on the user count but I always see 1 in user count. (see image in new tab)
User-added image


How can I prevent expiring access token???

Any help would be appriciated. Thanks for reading over my issue.

Thanks
I am using this developer forum and try to answer the problems that people face as per my knowledge.

But my profile is provate. how can I make my profile public?
My profile url
https://developer.salesforce.com/forums/ForumsProfile?userId=005F000000440rtIAA&communityId=09aF00000004HMGIA2

Thanks in advance. 

 

Hi all,

I have a custom object Task__c on which there is a self lookup field named dependent task (lookup to itself Task__c). I also have an external Id field on task object. Now I am inserting task records using  external Id in one statement. But I am getting this error

INVALID_FIELD, Foreign key external ID: task1 not found for field Dependent_Task__c in entity Task__c

See the code below.
 
List<sObject> TaskList = new List<sObject>();

Task__c objOne = new Task__c();
objOne.Name = 'Task1';
objOne.ExternalId__c = 'Task1';
TaskList.add(objOne);

Task__c objTwo = new Task__c();
objTwo.Name = 'Task2';
Task__c tempTask = new Task__c(ExternalId__c = 'Task1');
objTwo.Dependent_Task__r = tempTask;
TaskList.add(objTwo);

Database.SaveResult[] results = Database.insert(TaskList);

I guess the issue can be with sort order, because I was getting task2,task1 in list. So I tried sort method to sort the records in ascending order, but no luck
 
TaskList.sort();
Database.SaveResult[] results = Database.insert(TaskList);


Any Idea how this can be accomplish. How we can populate itself lookup using external Id in one dml statement. Any help will be appricated.
Thanks for your tme.
how can we create a start, pause and stop button to store time duration in salesforce, with accurate minutes, hours and seconds.
Like below is an example of html and javascript.
Example
I want to access visual flow from external (community) user. Since external user can't directly access Visual FLow, as per a workaround given in SF documentation, I have created a Visual Force page and calling a simple visual flow from inside that page. I have given page permission to community profile and also activated visual flow while creating it.

Above solution works fine on developer Edition but when I run it on Trialforce Enterprise Ed, it says "The data you were trying to access could not be found..."

I have tried giving permission for all objects to community user but no luck. Documentation says that I only have to give visual force page permission to community user.

Also I have tried to show this page by force.com site, But is is also showing error that "Authorization Required."

Plz help
When I create flow from outside the salesforc community, flow creates. But When I try to create flow from salesforce community. it gives me the error [Visualforce Remoting Exception: IO Exception: Unable to tunnel through proxy. Proxy returns "HTTP/1.0 404 Not Found]
It calls the official Salesforce Metadata SOAP API end points. Can anyone help me to out this?
public with sharing class AccountPagination {
    private final Account acct;  

    // The constructor passes in the standard controller defined
    // in the markup below
            public AccountPagination(ApexPages.StandardSetController controller) {
        this.acct = (Account)controller.getRecord(); 
    }    
    
    public ApexPages.StandardSetController accountRecords {
        get {
            if(accountRecords == null) {
                accountRecords = new ApexPages.StandardSetController(
                    Database.getQueryLocator([SELECT Name FROM Account WHERE Id NOT IN 
                        (SELECT AccountId FROM Opportunity WHERE IsClosed = true)]));
            }
            return accountRecords;
        }
        private set;
    }
    public List<Account> getAccountPagination() {
         return (List<Account>) accountRecords.getRecords();
    }  
}
This is javascript string on the vf page, It still giving SQL injection Issue on sceurity review.
how to avooid sql Injection in jquery??? 
My code is.. 
var q_text = "select JId__c from JOauth__c where SetupOwnerId= '";
var q_text1 = $('#currnetUserId').text();
// "currnetUserId" is the ID of span tag in another page
var q_text2 = "'";
var q = q_text.concat(q_text1, q_text2);
global with sharing class SchedularForBatchApex implements Schedulable {
        
        global void execute(SchedulableContext sc) {
            myBatchClass d = new myBatchClass();
              database.executebatch(d, 10);
        }
        
         Public static void SchedulerMethod(){
             SchedularForBatchApex s = new SchedularForBatchApex();
             string con_exp= '0 0 * * * ?';
             System.schedule('myBatchClass', con_exp, s);
         }
               
 }
Too many duplicate records in a custom_object__c, and have a custom field id__c, which is unique.
from Id__c I can find duplicate records. Now I want to delete duplicate records but remain 1 record. how this is possible.
I tried batch jobs. but didn't find any solution.
I am mapping accout with a custom object In a trigger. how can I access custom object fields from Account. 
Here is my code..

Map<ID, Account> mapaccounts = new Map<ID, Account>([SELECT Id, Name, phone FROM Account]);
    List<custom_object__c> RecodList = new List<custom_object__c>();
    RecodList.add( new custom_object__c(Name=mapaccounts.get().Name,  Phone__c =mapaccounts.get().Phone, custom_field__c =mapaccounts.get().account_field__c ))
 how to get map record (Here Entity_Type__c)
 Map<Id, Account> accounts = new Map<Id, Account>( [Select Id, Name,Entity_Type__c From Account Where Id in : sponsorShipOppties.keyset() ] );
  for( Opportunity o : sponsorShipOppties.values() ) {
        sponsorListingRecords.add( new Sponsor_Listing__c( Sponsor_Account__c = o.AccountId, Total_Sponsored_Amount__c = o.Amount, Status__c = 'New', Locations__c = locations, Entity_Type__c = accounts.get(o.Entity_Type__c) ) );
    }
trigger createSal on Employee__c (after insert, after update) {

       List<Salary__c> sal = new List<Salary__c>();

    for (Employee__c newEmp: Trigger.New) {
        if (newEmp.Name != null) {
            sal.add(new Salary__c(Id = newEmp.Id, Bonus__c=100,Monthly_Salary__c = 12000));
        }
    }
    insert sal;

}
here is my class..
@IsTest
public class TestrecordExt{
   
    static testMethod void TestEmp(){
   
        //test.startTest();
        List<employee__c> eList = new List<employee__c>();
        employee__c e = new employee__c();
        e.Name = 'test';
        e.Last_Name__c = 'test';
        e.Join_Date__c = Date.Today();
        e.City__c = 'test city';
        e.Phone__c = '123456';
        eList.add(e);
   
       
        e = new employee__c();
        e.Name = 'employee Name';
        e.Last_Name__c = 'emp Last Name';
        e.Join_Date__c = Date.Today();
        e.City__c = 'test city';
        e.Phone__c = '123456';
        eList.add(e);
       
        insert eList;
       
        recordExt r = new recordExt();
        r.saveEmp();
   
        //test.stopTest();
    }

}
This is my page..

<apex:page standardController="Employee__c" extensions="recordExt">
  <apex:form>
 
    <apex:pageBlock title="Employee Records">
    <apex:messages/>
   
    <apex:pageBlockButtons>
    <apex:commandButton value="Save" action="{!mySave}"/>
    <apex:commandButton value="Cancel"/>
    </apex:pageBlockButtons>
   
    <apex:pageBlockSection>
    <apex:pageBlockTable value="{!employee__c}" var="e" >
      <apex:column headerValue="Employee Name">
        <apex:inputField value="{!e.Name}"/>
      </apex:column>
     
      <apex:column headerValue="Last Name">
        <apex:inputField value="{!e.Last_Name__c}"/>
      </apex:column>
     
      <apex:column headerValue="Joining Date">
        <apex:inputField value="{!e.Join_Date__c}"/>
      </apex:column>
     
      <apex:column headerValue="City">
        <apex:inputField value="{!e.City__c}"/>
      </apex:column>
   
      <apex:column headerValue="Phone">
        <apex:inputField value="{!e.phone__c}"/>
      </apex:column>
   
      <apex:column>
        <apex:commandButton value="+" action="{!add}"/>
      </apex:column>
     
    </apex:pageBlockTable>
    </apex:pageBlockSection>
    </apex:pageBlock>
  </apex:form>
</apex:page>


and here is my controller.
public class recordExt {

    public Employee__c emp {get; set;}
    public List<Employee__c> empList {get; set;}
    public static Integer addCount {get; set;}
   
    public recordExt(ApexPages.StandardController controller) {
    this.emp = (Employee__c)Controller.getRecord();
    empList = new List<employee__c>();
    }
    
    public void add() {
       empList.add(new employee__c());
      //this.empList = new List<employee__c>();
     }
    
    public pageReference mySave() {
    try{
        insert emp;
        }
    catch(Exception ex){
            ApexPages.addmessages(ex);
        }
        return null;
   }
   
}
IF (object.Field__c.contains( 'string' ) ?
LIke..
 IF (object.Field__c. NOT contains( 'string' ) ?
do {
}
This is my vf page
<apex:page controller="MailBouncedController"  sidebar="false" Showheader="false" id="pg">
    <!-- Import Necessary Jquery js File and StyleSheets-->
    <apex:includeScript value="{!URLFOR($Resource.jQuery, 'js/jquery-1.6.2.min.js')}"/>
    <apex:includeScript value="{!URLFOR($Resource.jQuery, 'js/jquery-ui-1.8.16.custom.min.js')}"/>
    <apex:includeScript value="{!URLFOR($Resource.jqPlugin, '/jquery.blockUI.js')}"/>
    <apex:stylesheet value="{!URLFOR($Resource.jQuery, 'css/ui-lightness/jquery-ui-1.8.16.custom.css')}"/>
                    <script>
                function selectRecord(a,b)
                {                                     
                    window.opener.SetDonor(a,b);              
                    window.close();
                }
                function Exit()
                {
                    window.close();
                }             
            </script>
            <apex:pagemessages />
            <apex:form >
                <apex:pageblock >
                <apex:pageblockbuttons location="bottom">                     
                        <apex:commandbutton value="Exit" onclick="Exit();"/>
                    </apex:pageblockbuttons>
                    <apex:pageblockSection >
                        <apex:pageblockSectionItem >                  
                               <apex:outputpanel >
                                <apex:inputtext value="{!Searchstring}" style="width:130px"/>
                                <apex:commandbutton value="Search" action="{!SearchDonor}"/>
                             </apex:outputpanel>
                         </apex:pageblockSectionItem>
                     </apex:pageblockSection>
                     <apex:pageblockSection title="Contacts">
                    <apex:pageblocktable value="{!ConList}" var="Con" > <!--  rendered="{!ConList.size>1}" -->
                            <apex:column headervalue="{!$ObjectType.Contact.fields.Contact_ID__c.Label}">
            <!--       <apex:outputlink value="#" onclick="selectRecord('{!Con.Id}','Contact')">{!Con.Contact_ID__c}</apex:outputlink>
            -->       </apex:column>
          
                            <apex:column headerValue="Name">
                                    <apex:outputText value="{!Con.FirstName}"/>
                            </apex:column>
                          
                            <apex:column headerValue="LastName">
                                <apex:outputText value="{!Con.LastName}"/>
                            </apex:column>
                          
                            <apex:column headerValue="House No">
                                <apex:outputText value="{!Con.House_No__c}"/>
                            </apex:column>
                          
                            <apex:column headerValue="Building">
                                <apex:outputText value="{!Con.Sub_Building__c}"/>
                            </apex:column>
                          
                            <apex:column headerValue="Street" width="200%">
                                <apex:outputText value="{!Con.Street__c}"/>
                            </apex:column>
                          
                            <apex:column headerValue="Mailing City">
                                <apex:outputText value="{!Con.MailingCity}"/>
                            </apex:column>
                          
                            <apex:column headerValue="Post Code">
                                <apex:outputText value="{!Con.MailingPostalCode}"/>
                            </apex:column>
                          
                            <apex:column headerValue="State">
                                <apex:outputText value="{!Con.MailingState}"/>
                            </apex:column>
                          
                            <apex:column headerValue="Country">
                                <apex:outputText value="{!Con.MailingCountry}"/>
                            </apex:column>
                          
                     </apex:pageblocktable>
<!--                        <apex:outputpanel rendered="{!ConList.size==0}">
                            No records to display
                         </apex:outputpanel>
-->                     </apex:pageblockSection>     
                </apex:pageblock>
            </apex:form>
            
</apex:page>

and this is my controller...
public with sharing class MailBouncedController {

   // public String ConList {get; set;}
    public List<Contact> ConList {get; private set;}
    public string SearchString {get;set;}
    public string DonorName {get;set;}
    public string DonorAddress {get;set;}
    public Contact Donor {get;set;}
    public boolean showPopup {get; set;}
  
    public MailBouncedController(){
       //DonorName = 'Mr Syed Bilal Ali';
       //DonorAddress = '45 Bulding Sub Building Street London E17 8EN'; 
       Donor = new Contact();
    }
  
    public PageReference SearchDonor(){
        // List<Contact> ConList = new List<Contact>();
       // ConList = new List<Contact>();
        string s = SearchString + '*';
        try {
        List<List <sObject>> searchList = [FIND :s IN ALL FIELDS RETURNING  Contact(Id,Contact_ID__c,Account.Name,Email2__c,Email3__c,OtherPhone,Organisation__c,Street__c,
                                            Account_Number_2__c,Account_Number_1__c,MailingCountryCode,Building_Name__c,AccountId,IsPersonAccount,Sub_Building__c,Locality__c,
                                            House_No__c,Email,Salutation,MobilePhone,Phone,Firstname,LastName,MailingStreet,MailingCity,MailingPostalCode,MailingState,
                                            MailingCountry, AssistantName,AssistantPhone,Secondary_Email__c,Secondary_Last_Name__c,Secondary_Middle_Name__c,Prefix2__c )];
    
      
         ConList  =  ((List<contact>)searchList[0]);
         // system.debug(searchlist.size());
        //return null;
        if(ConList.size() > 1 )
                        {
                            showPopup = true;
                        }
            //return null;                    
       else if ( conList.size() == 1 ){
       DonorName = ConList[0].FirstName;
       DonorAddress = ConList[0].MailingStreet + ConList[0].MailingCity;
       showPopup = false;
                            
       }
      
       else if ( conList.size() == 0 ){
       apexpages.addMessage(new Apexpages.Message(apexpages.SEVERITY.info,'No matches found ! Try again'));
       showPopup = false;
                        }              

        }
      catch(Exception ex){
                       showPopup = false;
                       ApexPages.addMessages(ex);
                 }  
                  return null;
    }
  
}
i have two object employee__c(Name, total_salary__c) and salary__c (Monthly_salary__c, Bonus__c). They have a lookup relation.

This is my Trigger

Trigger TotalSalTrigger on Salary__c (after insert) {
    Salary__c sal = trigger.new[0];
    List<Salary__c> s = [SELECT Monthly_Salary__c, Bonus__c FROM Salary__c where Employee__c =:sal.Employee__c limit 30000];
    decimal amt =0;
    for(Salary__c ss:s){
        amt += ss.Monthly_Salary__c + ss.Bonus__c;
    }
    List<Employee__c> emp = [SELECT id FROM Employee__c where id= :sal.Employee__c limit 1];
    for(Employee__c e:emp)
    {
        e.Total_Salary__c = amt;
        }
    update emp;
}
Hi All,

Hope you will be fine. 

We have developed REST webservices in Salesforce and then calling these APIs from External system (Wordpress/PHP) using OAuth 2.0. We have created an app in salesforce as required.

We are encountring an issue that sometimes our access token get expired. We are unable to find that why the access token is expiring. Sometime access token expires within a day and sometime the access token works for couple of weeks.

You can see my app setting in Salesforce. 
User-added image

REST App setting in Salesforce
User-added image

I read some articles where it is said that the access token expires based on the user count but I always see 1 in user count. (see image in new tab)
User-added image


How can I prevent expiring access token???

Any help would be appriciated. Thanks for reading over my issue.

Thanks
When I create flow from outside the salesforc community, flow creates. But When I try to create flow from salesforce community. it gives me the error [Visualforce Remoting Exception: IO Exception: Unable to tunnel through proxy. Proxy returns "HTTP/1.0 404 Not Found]
It calls the official Salesforce Metadata SOAP API end points. Can anyone help me to out this?
This page has an error. You might just need to refresh it.We are reporting this as error id (780888435).

I am getting this error while creating Opportunity in lightning in production org.

Please help to resolve this.
I have created a trigger(after update) on Lead which will fire on status change and create a contact and custom object record.

Issue is that trigger is working but creating around 7 records of contact and custom object , i am not able to debug this , any help would be helpful.

Trigger:

Trigger CreateContact on Lead (after insert, after Update) {
    if(Trigger.isInsert) {
        LeadTriggerHandler.createContact(Trigger.new);
    }
        if(Trigger.isUpdate) {
        LeadTriggerHandler.createContact(Trigger.new);
    }
}

Class:

public class LeadTriggerHandler {
    public static void createContact(List<Lead> leads) {
        List<Application__c> app = new List<Application__c>();
        List<Contact> contact = new List<Contact>();
           for(Lead acc : leads){
            if(acc.Status=='Interviewed'){
            Contact con = new Contact(LastName = acc.lastname,
                                     FirstName= acc.FirstName,
                                     RecordTypeId='someid');
            contact.add(con);
        }
        insert contact;
        }
        for(Lead acc : leads){
            if(acc.Status=='Interviewed'){
            Application__c a = new Application__c(Name = acc.Lead_Program_Name__c,
                                                 Program__c= acc.Program__c,
                                                 Last_Name__c= acc.LastName,
                                                 First_Name__c= acc.FirstName,
                                                 Program_Session__c= acc.Program_Session__c);
            app.add(a);
        }
        insert app;
        }
    }
}

 
Error:-
|System.QueryException: unexpected token: 'null'


i am getting this error in myclass when i not selected any field
i need to this is dynamically hoe can i do that 

my query like:-

select ID,P_Edition__c,p_Opprotuny_name__c,P_Opportunity_ID__c,P_Stage__c,P_Banner__c,null from opportunitylineitem where P_Edition__c = 'Adipec 2018'

how can avoid that if any time i skeep that field and run the class did not get this error please help me
In our current requirement they want to get the external PDF by using external URL, i have tried by using Blob with the reference URL https://developer.salesforce.com/forums/?id=906F00000008yc3IAA , but i am not able to read the content from the PDF. When ever i m trying to access the PDF i am getting below error. Could anyone tell me is it possible by using Apex class?

User-added image

Thanks.
Nazia
Create a new trigger to automatize the fulfillment of this field with other existing activity(ID) if the following conditions are true:
A new activity(event) is created with:
Type = meeting
Created by a user with Profile Name starting with "Sales Representative".
Subject contains "Initial Meeting" and does not contain "Additional" nor "Cancelled" nor "Resch".
The existing Activity (event) meets the following :
Subject does not contain "Additional" nor "Cancelled" nor "Resch".
Subject contains "Initial Meeting".
The contact/lead (WhoId) has the same Name in both activities (events).
The Start Date of both activities (events) is the same or separated 3 days at most.
If more than one match is found, select the oldest activity(event).

I tried the following, but am stuck in getting the user name with profile "Sales Representative"
trigger eventSetSameAs on Event (before insert) {
    Map<ID, Event> sameEvent = new Map<ID, Event>();
    //Check for the new event
    for(Event newEvent: system.trigger.new){
        Event oldEvent = System.Trigger.oldMap.get(newEvent.Id);
        //Get the list of users with profile Sales Representative
        List<User> userProfiles = [SELECT Id, Profile.Name FROM User WHERE Id IN : trigger.newMap.keySet() and Profile.Name = 'Sales Representative'];
        //Check for the following conditions
        if(newEvent.Type == 'Meeting' && 
           ((trigger.newMap.get(newEvent.id).subject.contains('Initial Meeting')) && 
             (!trigger.newMap.get(newEvent.id).subject.contains('Additional')) || 
              (!trigger.newMap.get(newEvent.id).subject.contains('Canceled')) || 
               (!trigger.newMap.get(newEvent.id).subject.contains('Resch')))) {
           if(newEvent.CreatedBy == )
            newEvent.Same_As__c = oldEvent.Id;
            }
        }
    }
Can you please help me in completing this trigger?
TIA
Hey can anyone help in reporting of following scenario?

Create a report on Lead object which would return all the Lead records on which Telecalling is supposed to be performed in the next month.
Only the records qualifying the following criteria would be displayed in the report
-> Lead Status - 'Open - Not Contacted'
-> Lead Source - 'Web' Or 'Other'
-> Last Modified date should fall under last three months from today.

The report should display the record count for each 'Lead City' for each 'Lead Priority'.
This would be essentially a Matrix Report Create a suitable dashboard for the same. Custom Field Details
1) Lead City - type - Picklist
2) Lead Priority - type - Picklist (P1, P2, p3, p4)
  • July 31, 2018
  • Like
  • 0
Hi,
 one list view the Inline edit is disabled and comment is : to edit filter by one record type ??! 
there is no logic filter in the list , and I have all permisions to edit !
Hi! I'm trying to do a GET request to an Apex. I followed the OAuth 2.0 procedure to get an access token from Salesforce by using my username and password.
When using this token in the GET request to the Apex REST endpoint, I get a 401 error with the message '[{"message":"Session expired or invalid","errorCode":"INVALID_SESSION_ID"}]'.

What am I doing wrong?

I use the PHP code below. $token is the access token I got from the https://login.salesforce.com/services/oauth2/token request, and it is executed directly after receiving the token (xxxx is replaced):
$curl = curl_init();

curl_setopt_array( $curl, array(
    CURLOPT_URL => 'https://xxxx.salesforce.com/services/apexrest/xxxx',
    CURLOPT_POST => false,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HEADER => array( 'Authorization: Bearer ' . $token )
) );

$response = curl_exec( $curl );
curl_close( $curl );
I have created a web to case form in html in which there is a date field.I want to save the data entered in the date field though pop up calendar into a date field that i have created in the case object.But it is not taking the value of the date field. 

Salesforce Developer - £50,000 - £65,000
 
I am working alongside a boutique Salesforce Partner who are looking for a Salesforce Developer. The role will be predominately based within London and you will be working on a number of new greenfield sites. This is an exciting opportunity to grow a Salesforce Development team around yourself, at the moment the consultancy boasts more than 20 consultants on a permanent basis.
 
They are working on a wide range of projects including configuration, customisation, integration and implementation making this an exciting position within the Salesforce market. They are currently working within both the Sales and Service platforms within Salesforce.
In return the client can offer further Salesforce Certifications and training within the platform.
 
Key Skills –
 
2 years + as a Salesforce Developer
Strong skills within Apex, Visual Force and Batch Apex
Project exposure including configuration, integration, implementation and customisation
Salesforce Developer Certification would be advantageous
Package –
 
£50,000 - £65,000 depending on experience
Further Salesforce Certifications 
Further Salesforce training
Pension

Performance related bonus
-----------------------------------

Salesforce Developer, Salesforce Development, Salesforce Senior Developer, Salesforce Lead Developer. 

I need a salesforce developer to help me integrate Salesforce with Boberdoo. I need to be able to send lead information in one of my Salesforce Campaigns to my Boberdoo campaign. I understand this can be accomplished via API, though I do not have the exprerience to do so myself. Successful work will lead to future projects, if interested. 

Thank you

Hello Folks,

We are team of Salesforce Developers, Consultants and Architects with the experience of more than 7 years in Salesforce and Force.com

LogicRain specializes in

* Visualforce and custom controller extensions 
* Integration using Apex web services and Force.com API 
* Portals and Force.com Sites 
* Apex triggers 
* Apex Web services involving REST, and SOAP 
* Managed packaging and
* Customer Portal and Partner Portal
 
Our customers find Our Rates Competitive along with keeping trust with respect to the Quality Work and Timely Delivery.
 
Our focus areas are: 

a) Complex Visualforce and custom controller extensions 
b) Integration using Apex web services and Force.com API from .NET/PHP/Java 
c) Customer portal, Partner portal, and Force.com Sites 
d) Complex business rules using Apex triggers 
e) Apex Web services involving XML schemas, REST, and SOAP 
f) Apex governor limits and how to design around them 
g) Make Apex code ready for Force.com Application Security review and managed packaging

The cooperation format that we can offer to you can be based on any of the worldwide standard models (FP, FT, T&M, etc.) or any of their mixes and any other specifics that we agree upon. We want to consider all of the details of a potential project before we come up with the best possible price given the expected level of quality and timing expectations of yours.

Please reach us out on biz@logicrain.com or +1.732.676.6400 for further details regarding our company.

Best Regards!
Hello, 

We are looking for some Salesforce development experience to help on an adhoc basis with some exciting cutting edge work in a well established financial insitution. Contact me if you are interested. Thanks Matt
Hi All,

I've recently started having issues with production code whereby an overnight batch started complaining about "Batchable instance is too big". I suspected that the heap size might have at some point exceeded its limits (due to the batch having a stateful shared map that accumulates data across the batch execution blocks). Upon inspection the system was throwing error when the heaps size reached 42% (approx 5.4 million bytes) of its heap size capacity. Confused I called all the Limits class methods at the end of the execution block to see if anything had exceed its limts, yet the only thing even remotely alarming was the heap size, of which again was not exceeding the limit.

In response I tried to replicate the issue with a simple example. The class I created is shown below:

  global class TestBatch implements Database.Batchable<sObject>, Database.Stateful
  {
      global Map<Integer, Integer> globalMap = new map<Integer, Integer>();

      global Database.QueryLocator start(Database.BatchableContext bc) 
      {
          return Database.getQueryLocator('SELECT Id FROM Account');
      }

      global void execute(Database.batchableContext bc, List<sObject> objects)
      {
          Integer i=globalMap.size();
          final Integer interval = 1000;
          for(Integer x=0; x<100000; ++x)
          {
              globalMap.put(i, i);
          
              if(Math.mod(x,interval) == 0) 
              {
                  System.debug(LoggingLevel.Error, 'Limits.getHeapSize(): ' + Limits.getHeapSize());
                  System.debug(LoggingLevel.Error, 'Limits.getLimitHeapSize(): ' + Limits.getLimitHeapSize());
              }
              
              ++i;
          }
      }
      
      global void finish(Database.BatchableContext bc) 
      {
      }
  }

This code should easily compile in any sandbox. If you open the command line and enter the following command:

  Database.executeBatch(new TestBatch(), 1);

It should iterate throught few times, assuming that there are a few accounts in the system. After two successful execution blocks, the system started complaining with the same error, even though the heap size only reached approximately 2.7 million bytes.

Does anyone have any throughts as to why Salesforce complains about a large instance when it hasn't even reached half way through their enforced limits?
Hi,

       I have written custom component and test class, i'm tried to deploy the code(Custom component and Test class) sandbox to production, i got Error: INVALID TYPE - My test class, I don't no what is a problem, Kindly give any solution to this

Thanks.
I could not access my Test Class Methods in my Developer Edition Account Like Test.StartTest(), Test.StopTest() or Test.setCurrentPage() methods, I could be able to do it before but from today only when I am saving the test class with this methods its giving me compile time errors and the test classes in which I have used it earlier. Its throwing exception at run test.

What could be the reason.
Hi All,

Can we get the Discussion forum Solutions be mailed to more that one Email Id.
Kinldy let us know possibilities.

Thanks and Regards,
Christwin
Hi All,

I need to create an Instance of an Object at runtime. I change the ObjectType string at runtime in the below code.

String ObjectType = 'Cars__c';
Type t = Type.forName(ObjectType);
 sObject newObj = t.newInstance();
newObj.Name = 'test';
insert newObj;

I get an error like  "Compile Error: Illegal assignment from Object to SObject "

Anywere in the code I should not have the hardcoded APIs like Cars__c. I get all these from custom settings.Could someone please guide me.
Kindly also let us know the difference between SObject and Object.
Thanks and Regards,
Chirstwin

We developed and implimented Salesforce but now need more and future development.

 

We are not utilizing Salesforce as well as we should be and we need to add a new company as well.

 

Please do respond quickly if you can help. We are located in Florida and use the cloud.

 

Regards,

Roderick Kabel

Marketing & SEO Director

 

  • April 22, 2013
  • Like
  • 1