• Shailesh Deshpande
  • SMARTIE
  • 1195 Points
  • Member since 2010

  • Chatter
    Feed
  • 41
    Best Answers
  • 1
    Likes Received
  • 1
    Likes Given
  • 17
    Questions
  • 241
    Replies
The challenge is:

You've been given a requirement to keep Contact addresses in sync with the Account they belong to. Use Process Builder to create a new process that updates all child Contact addresses when the address of the Account record is updated. This process:Can have any name.
Must be activated.
Must update Contact mailing address fields (Street, City, State, Post Code, Country) when the parent Account shipping address field values are updated.

I start with Accounts when records is created or edited.
Filter criteria where accounts shipping address (street, city, state, zip code) is changed (used "or" logic).

I am stuck on the next step "add action".  I started with action type "Update Records".
On objects, I can't seem to change Accounts to Contacts.  Why?
I'm just trying to update a lookup field value (Campagna_Account__c) on Account object using a trigger that should update it getting the value from a custom object (Sottocampagna__c).
I think the query is right because it runs well on Force.com Explorer, so I think the problem is somewhere else.

Here's the error line displayed when trigger fires:

data changed by trigger for field Campagna: id value of incorrect type: a06250000004FDNAA2

Here's my code:
trigger PopolaCampagna on Account (before insert, before update) {

Sottocampagna__c var = [
SELECT Campagna__r.Id
FROM Sottocampagna__c
WHERE Name='Segugio'

];

for (Account a: Trigger.new) {
a.Campagna_Account__c = var.Id;
   }
}
Thank you for helping me!

 
Hi all,

Base on my code below, how can I programmatically decide whether or not the current user session is in the service cloud console?

I would like the user to be able to got to this link and have it render in console or regular; https://cs7.salesforce.com/apex/Launcher?txnID=a0AM0000004P7Se

................
Page (Page name = Launcher)
................
<apex:page controller="LauncherController" action="{!processRequest}">

</apex:page>
................
Controller
................
public class LauncherController{
    private String transactionID{get;set;}

    public LauncherController(){

    transactionID = ApexPages.currentPage().getParameters().get('txnID');

    }//end-method

    public PageReference processRequest(){ 

    PageReference pageRef;  

    // if console

    pageRef = new PageReference('https://cs7.salesforce.com/console#%2F' + transactionID);

    // else

    //pageRef = new PageReference('https://cs7.salesforce.com/' + transactionID);

    // end-if

    if(transactionID==null){
      return pageRef;
    }
    return pageRef;
    }
}
Hello all,
I am new to Salesforce.Can anyone please help with this problem.
 I am trying to Build a trigger.The trigger should fire whenever an Account object is modified.The trigger should detect if the billing address on the Account has changed.If the Account billing address has changed, the new billing address should be copied to all Contact records related to that account
I have an Opportunity Object which has Two Page Layouts ( Say Old, New) which has a Picklist field GENERATE ( values are Invoice, Porcessing)..

When Enter value as Invoice and Save, it Should show Old Page Layout. Same way, When I give Processing It have to Show New Page Layout.

How to do it?

Thanks. 
To Create Account Reviewer profile with only read only access to account object, with salesforce license type, which profile should i clone to be able to create this profile without having the need to uncheck edit / create / delete buttons for so many objects to which standard profiles with salesforce license have access to.
<aura:component>
    Observe!  Components within components!

    <auradocs:helloHTML/>

    <auradocs:helloAttributes whom="component composition"/>
</aura:component>

When I'm saving the above code in developer console, then getting this error:

FIELD_INTEGRITY_EXCEPTION
Failed to save undefined: No COMPONENT named markup://auradocs:helloHTML found : [markup://c:nestedComponents]: Source

I have already created helloHTML and helloAttributes components.Any idea what's happening!
 

 

I want to diplay a table of products prices with product ID, have found that visualforce is making autoconversion which I want to avoid. 

 

The Apex SOQL query:

SELECT Id, Product2Id, Pricebook2Id, UnitPrice, CurrencyIsoCode, IsActive, UseStandardPrice FROM PricebookEntry WHERE // some coditions

 

Visualforce:
<apex:pageBlockTable id="pricesList" value="{!allPricesList}" var="price">
<!-- Id, Product2Id, Pricebook2Id, UnitPrice, CurrencyIsoCode, IsActive, UseStandardPrice -->
<apex:column headerValue="Product Id" value="{!price.Product2Id}" />
<apex:column headerValue="Pricebook Id" value="{!price.Pricebook2Id}"/>
<apex:column headerValue="CurrencyIsoCode" value="{!price.CurrencyIsoCode}"/>
<apex:column headerValue="UnitPrice" value="{!price.UnitPrice}"/>
<apex:column headerValue="UseStandardPrice" value="{!price.UseStandardPrice}"/>
<apex:column headerValue="IsActive" value="{!price.IsActive}"/>
</apex:pageBlockTable>

 

After page is rendered {!price.Product2Id} and {!price.Pricebook2Id} is changed to link to product/pricebook with its name. I want to have just salesforce ID here.

I tried:

{!price.Product2Id__r.Id} gives error: Invalid field Product2Id__r for SObject PricebookEntry

{!price.Product2Id.Id} error: Unknown property 'String.Id'

 

When I am diplaying content of List whoch hold values from SOQL which are given to VF page I see:

 

CurrencyIsoCode=EUR, IsActive=true, UseStandardPrice=false, Id=01uD000000B7LpVIAV, UnitPrice=1.00, Pricebook2Id=01sD0000000FE0sIAG, Product2Id=01tD0000001OvXoIAK
 

So conversion is made on VF page. How to stop it?

 

Hi,

although i've studied the documentation, i can't find the answer to my question: is it allowed to call a batch class from an @future method? Maybe i can't find it because it is simply allowed, but need to be sure, for my entire design is depending on it.

Hope for some respons!

Br, Marco

  • April 05, 2013
  • Like
  • 0

Hi

 

Difference between <apex:pagemessages> vs <apex:messages>

 

In which sittuation we are using <apex:pagemessages> and <apex:messages>.

 

can you explain.

 

Regards.

Hi .

 

I am very new to Salesforce.

 

Can anyone please tell me the difference between.

 

1.OWD

2.Sharing rule

3.Permission Sets

 

Thanks in advance..

Hi,

 

I wanted to make sure that I understand the Batch Apex process.

If I have a 1000 records processing in Batch Apex with default of 200 record iterations and within this iteration I am creating sets and maps that look up other objects and I update data in those objects does that get perminately updated after each 200 iterations or when the complete Batch process finishes.

I have requirment to update a field on the account page when a salesperson creates a certain type of task.

 

I have it working fine when I don't have the code checking to ensure that the task creator is the account owner. But I get an error that the Account owner is not a variable when trying to compare. See red text.

 

Any thoughts?  

 

trigger AccountVisit on Task (after Insert) {

      Set<id> accountid = new set<id>();

             for (Task tsk : trigger.new){

                        if  (tsk.Type == 'Meeting'){

                            accountid.add(tsk.whatID);

              }

              }

                  List<account> acctlist = [SELECT id

                                           FROM account

                                           Where ID in :accountid];

For (account acc : acctlist && acc.Owner = tsk.CreatedBy)

       {               acc.Last_Formal_Business_Review__c = system.today();

       }           update acctlist

;  }

 

Hi all,

 

I am trying to compare two apex:variables (Current Prod Type and the previous prod type) and if they are different do a Subtotal line in a table:

 

 <apex:outputText value="{!if(!myProdTyp == !LastProdTyp,'','<tr><td>SUBTOTAL</td></tr>')} ">
  </apex:outputText>

 

Both LastProdTyp and myProdTyp are apex:variables.

 

I am getting an error message when I try the above syntax saying: Error: Incorrect parameter type for function 'not()'. Expected Boolean, received Text

 

Please advise. Thanks in advance!

-Jim

I'm a newbie to controllers and need some help sorting a pageblocktable.

 

Custom Object:  Apartment__c

Related List:  Unit__c

Result:  Sort Units by Nickname__c

 

Simple VF Page:

<apex:page sidebar="false" showHeader="false" cache="false" standardController="Apartment__c" extensions="sortExtention" >
<apex:form >
<apex:pageBlock >
<apex:pageBlockTable value="{!sortExtension}" var="item">
<apex:column value="{!item.ID}" />
<apex:column value="{!item.Unit_Number__c}" />
<apex:column value="{!item.Nickname__c}" />
<apex:column value="{!item.Available__c}" />
<apex:column value="{!item.Bedrooms__c}" />
<apex:column value="{!item.Bathrooms__c}" />
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>

 

Controller

public class sortExtension{

public Apartment__c Apt;
public ApexPages.StandardController controller {get; set;}
public List<Unit__c> units; public sortExtension (ApexPages.Standardcontroller c)
{
this.controller = c; Apt = (Apartment__c)Controller.getRecord(); }
public Unit__c [ ] getUnitList()
units = ([Select ID,Unit_Number__c,Available__c,Bathrooms__c,Bedrooms__c,Nickname__c from Unit__c Where Apartment__c.Unit__r = :TC.id ORDER BY Nickname__c]);
return units;}

 

ERROR:  Compile Error: unexpected token: 'units' at line 9 column 7

 

Thank you in advance for your help!

Hi

 

How can bypass SOQL statement to fetch more 1000 records in salesforce

 

Hi, I am new to APEX development. I have created a new trigger to update a custom field on the Lead object. I have to use 'after update' since I need to have the OwnerId. It works, however, I just KNOW it is not properly coded. Can someone please review and let me know how it really should be? Especially regarding what is referred to as ‘bulkification’?

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

trigger UpdateLeadOwner2AfterInsertUpdate on Lead (after insert, after update) {

 

string txtLdID;



for (Lead newLead : [Select Id,OwnerId,Lead_Owner_2__c from Lead where Id in :Trigger.new]) {
        
// Update the Lead Record
        txtLdID = newLead.OwnerId;
        if (newLead.Lead_Owner_2__c <> newLead.OwnerId && txtLdID.startsWith('00G') == FALSE) {
          newLead.Lead_Owner_2__c = newLead.OwnerId;
          update newLead;
        }  
              
    }
        
}

Wondering if this is possible.

 

I have several opportunity record types and on all of them I have a field called "New Business". The is a formula field. I am wondering if on a specific record type I can change the formula without having to create a new field to do this. I would like to use the same "New Business" field on all my record types but have it calculate different on a specific record type.

 

Thanks,

Katelyn

Hi...

 

I am trying to insert more thant 60,000 records throuth Data loader in my instance and there is a berfore insert trigger on that  object..

 

my question is that ... Is that trigger  fired on all 60,000 records?

 

I am using SOQL query in trigger, as per governor limits SOQL query handles only 10,000 records ... is it possible to fire on all records ? any one please clarify my doubt .
 

Hi,

 

I wrote some code that uses a helper class and stores the items in a list which feeds the pageBlockTable on the VF page.  This helper class has a boolean which is my checkbox on the VF page.  How can I write the test class to check one of the records?  Not to over populate this post I have snippets of the VF and controller.  I am still struggling with test code scripts.  If you need me to post all the code in order for you to help me on this issue I can.

 

I'm not sure how I get the test class to check one of the records that show on the VF page.  I appreciate your help.  Mean while I will keep hacking a way at this!

 

VF PAGE:

<apex:pageblocktable value="{!UserChatterGroupList}" var="item" rowClasses="even,odd">
                <apex:column headervalue="Select Record" headerClass="ColumnHeaders" width="80">
                    <apex:inputcheckbox value="{!item.recordSelect}"/>
                </apex:column>

 

Controller Class:

public class CFCT_UsersNotInChatterGroups_Controller {
    public  String ChatterGroupsMissingMessage { get; set; }
    public  List<HelperClass> UserChatterGroupList { get; set; }
...
...
...
    // Helper Class
    public class HelperClass {
        public boolean recordSelect {get; set;}    
        public Id GroupId {get; set;}  
        public id UserId {get; set;}   
        public String UserName {get; set;}
        public String ChatterGroupName {get; set;}
    }
}

 

 

 

 

We have a case where our users create tasks. When they create tasks, they also check the "Send Email Notification" checkbox present on the task. As a result the owner of the task, receives an email containing task details and a link to the task. However, when the user clicks on the link received in the email, he is redirected to the homepage instead of the task record detail page. I did notice one difference in the link present in the email and the actual URL that is required to navigate to the task record.

The atual URL needed to navigate to the records is as below:

https://mycompanydomain----my-salesforce-com- gatewayinfo/recordId

Wheras the URL recieved in the mail is:

https://mycompanydomain--my.salesforce.com/recordId

I dont understand why this difference in the URL. We are using SSO in our org. Is it the reason? We are also using Cipher Cloud to encrypt/decrypt our data. Can this be one of the reason?

I also tried this for other objects by using Workflow Email Alerts. But the difference in the URL still persists.

What can be donr so that the proper URL is sent in the mail?

Hi,

 

1. I am having a trigger on Event object. The trigger is written in such a way that there can be no two Events or Meetings for the same user at same time. This works fine when we deal with normal events however when we try to create a recurring event, I get an error saying "Changes made to the series will affect all occurrences on or after mm/dd/yyyy."

 

Does any body know what can be the issue behind this?

 

Due to above error I have temporarily disabled Recurring Tasks and Events in my org.

 

2. Also I am trying to write the test coverage for this, the logic for avoiding duplicate events gets covered properly. jowever, I am unable to cover the code which was written to avoid duplicate Meetings. I am distinguishing between Events and Meetings by the "GroupEventType" field on the event object.

 

Please let me know if there is a way by which i can cover that code.

 

Thanks,

Shailesh. P. Deshpande

HI,

 

I have a object "Key Combination Lookup" to which i have given "Read only" permissions to other users .ie. users cannot create or edit a Key Combination Lookup record.

 

I have a trigger on Account. On insert of account, the trigger creates a Key combination lookup record. The relationship between the Account and Key Combination lookup is a Lookup relationship.

 

Now, when other users create an account, the trigger is creating a key combination lookup record. I dont understand why this is happening, since the users do not have create permissions on key combination lookup object. 

 

Is it that trigger is executing in system mode? 

 

Thanks,

Shailesh.

HI,

 

I am creating a Meeting request from the Calendar Section on the Home page. As per salesforce documentation, when we create a Meeting request and confirm it, it gets converted into a multi person event.

 

But when I confirm the Meeting, the meeting does not get converted into the multi person event.

 

I debugged and found out that i am having a trigger on Event object which is referring to the Start Date & End Date fields on the event object. Hence I am getting an error while i confirm the meeting, as the Start Date and End Date fields on the event during conversion are Null.

 

But then if i comment out those 2 statements from the code, an event is created on conversion. What is weird here is that the Start Date and End Date fields on event are populated with the value of Meeting's Start and End date Time. So i dont understand, why is the value shown as null when the trigger is fired.

 

Can anybody help me with this? OR can anybody provide me what fields of Meeting are Mapped into event on conversion as i dont find any documentation on this. Also is there any way by which we can identify whether the event is a created manually or from Meeting Request?

 

Thanks,
Shailesh.

Hi,

 

I have a button on a page, onclick of which i am creating tasks and attachments related to those tasks. This works fine when i launch the page from the salesforce org. However, when i use this page as a site page, i get the below error:

 

"Insufficient Privileges

Insert failed. First exception on row 0; first error: INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, insufficient access rights on cross-reference id: []"

 

Below is my function:

      public void saveEmailAsActivity(String appId, Messaging.SingleEmailMessage email)
        {
            /* Start - Added on 12th September 2011*/
            User objUser = new User();
            String strUserName = 'test@sfdcsiteuser.com';
            objUser = [Select Id from User where username=:strUserName];
            /* End - Added on 12th September 2011*/
            
            //Create an activty related to Applicant.
            Task objTask = new Task();
            objTask.Status = 'Completed';
            objTask.whatId = appId;
            objTask.Subject = 'Email:' + email.subject;
            objTask.Description = 'Body:' + email.getHTMLBody();
            objTask.OwnerId = objUser.Id; //Added on 12th September 2011
            insert objTask;

            //Create Attachment(s) if present within the email related to the above activity.
            List<Attachment> lstAttach = new List<Attachment>();
            if(email.getFileAttachments() != null)
            {
                for(Messaging.EmailFileAttachment objEFA: email.getFileAttachments())
                {              
                    Attachment objAttach = new Attachment();
                    objAttach.ParentId = objTask.Id;
                    objAttach.Name = objEFA.getFileName();  
                    objAttach.Body = objEFA.getBody();
                    objAttach.ownerId = objUser.Id;
                    lstAttach.add(objAttach);
                }
                if(lstAttach.size() > 0)
                    insert lstAttach;
            }      
        }

 

Now if i comment out the "insert lstAttach" portion, the code works fine. However it gives an error only when i try to insert the attachment.  I cannot remove the "objAttach.ownerId = objUser.Id" line, because it gives me another error saying that the "Owner of the attachment must be the same as that of parent task" and if i keep that line i get the "Insufficient Cross Reference Entity" Error.

 

Can anybody help me with this?

 

Thanks,

Shailesh.

HI,


I have implemented a simple visualforce page where i am showing a picklist called "Industry Experience" from the contact object. When a user selects some value from the picklist, the page is shows all the contacts that have the selected value.


This works fine when the logged in user is having the Language set to "English". When I login as a different user whose language is other than "English", say for eg: "Spanish", or "Portugese" then the values that are shown in my picklist are translated to that particular language and when i select a particular value and search, the page does not show any contact.

 

For eg:
When i login as a user whose language is English and I select a value from the picklist : "Tech: IT, Software & Computer Services" then this returns 2 contacts.


But  When i login as a user whose language is Portugese, the picklist shows me this value: "Tecnologia: Informática, Software & Serviços de Informática" instead of  "Tech: IT, Software & Computer Services". When i click search, this returns me no contact,however there are 2 contacts existing with this value.

 

How can i overcome this. Can anybody help me with this?


Thanks,

Shailesh.

HI,


I have implemented a simple visualforce page where i am showing a picklist called "Industry Experience" from the contact object. When a user selects some value from the picklist, the page is shows all the contacts that have the selected value.


This works fine when the logged in user is having the Language set to "English". When I login as a different user whose language is other than "English", say for eg: "Spanish", or "Portugese" then the values that are shown in my picklist are translated to that particular language and when i select a particular value and search, the page does not show any contact.

 

For eg:
When i login as a user whose language is English and I select a value from the picklist : "Tech: IT, Software & Computer Services" then this returns 2 contacts.


But  When i login as a user whose language is Portugese, the picklist shows me this value: "Tecnologia: Informática, Software & Serviços de Informática" instead of  "Tech: IT, Software & Computer Services". When i click search, this returns me no contact,however there are 2 contacts existing with this value.

 

How can i overcome this. Can anybody help me with this?


Thanks,

Shailesh.

Hi,

 

I have a String as '[!TEST!]' . Now I wish to replace this string with some other string say "SFDC". I am not able to do so.

I am using the String.replaceAll() function.

 

Below is a eg:

 

String str = 'Hi! How aRE YOU? I hope you are fine. D.';

str = str.replaceAll('[!Test!]','SFDC' );

system.debug(str);

 

Now this code replaces exclamation, T, e, s , t with SFDC. i.e the output is:

 

HiSFDC How aRE YOU? I hopSFDC you arSFDC finSFDC. D

 

which i am not expecting.

 

How can i replace this entire string .i.e [!Test!]

 

Thanks,

Shailesh.

HI,

 

I have a object (Deal_Team__c) which has two lookup fields -

1. User  -- lookup to user

2. Loan  -- lookup to a custom object Loan

 

Now when i insert a record in Deal Team, i have a trigger which calls a class, that creates a new Loan Share Record based on the user id and loan id in Deal Team and grants Edit(Read/Write) permission to the user.

 

What i want is that once a user is added to the loan share object(through code or any other means) who has Read/Write access, he should be able to add other users to the loan share object for that loan record.

 

When i login as another user who is present on the loan share record(added through my code), I am unable to do this and I get an Error saying "INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY".

 

So I removed the with sharing keyword on my class. This works the way i want, but the problem here is that even if the user is not added initially in the loan share, still then he is able to add himself or other users in  the loan share which should not happen.

 

Is there any way by which i can achieve this?

 

Thanks,

Shailesh.

 

Hi,

 

I wish to use the fields that are been added in he field sets by the user in my SOQL Query. Is there a way by which we can determine what fields have been added in the field sets?

 

I went through this blog: http://blog.sforce.com/sforce/2011/02/using-field-sets-in-spring-11.html ,but it is mentioned specifically " You do have to make sure that the SOQL query includes all the fields that could possibly be included in the Field Set."

 

Has any solution come up for this?

 

Thanks,

Shailesh.

I have a number field with length as 4 on Campaign object. Now when a user enters a value as 1000, it is automatically formatted as 1,000. I do not want it to get formatted. I simply want to show it as 1000 instead of 1,000. Is it possible to avoid his formatting. I dont want to write a class/trigger to do so.

Hi Guys,

 

You must all have worked on "pageBlock " and "pageBlockButtons". Did anyone of you notice that if you give a "title" to pageBlock and also use "PageBlockButtons", the buttons on the upper section and lower section are not properly aligned...

The ones in the above section are shifted towards right to some extent...Just wanted to ask if anyone of you have faced the same issue...if yes, did you find any solution for this? If so, please post it here.

 

Thanks,

Shailesh. P. Deshpande

Hi Guys,

 

You must all have worked on "pageBlock " and "pageBlockButtons". Did anyone of you notice that if you give a "title" to pageBlock and also use "PageBlockButtons", the buttons on the upper section and lower section are not properly aligned...

The ones in the above section are shifted towards right to some extent...Just wanted to ask if anyone of you have faced the same issue...if yes, did you find any solution for this? If so, please post it here.

 

Thanks,

Shailesh. P. Deshpande

Hi,

 

I have an object called PR. I have an after insert trigger on this object. This trigger has two batch classes within it, both of which make a callout to Zendesk Api. The problem i am facing is that i am not recieving a response for one of the callout. Sometimes i recieve the proper response for the callout made in 1st batch class and for the callout from 2nd batch class i recieve null in response while other times its reverse case. i.e response is null for the 1st callout and for 2nd callout i get proper response.And sometimes i get both the response correctly... I am facing this issue since last 2-3 days, however a week before everything was working fine.

 

Not sure whats wrong. Is that because i am making two back to back webservice callout? Or is it that there needs to be some time gap between two callouts?

 

Any help/suggestion is appreciated.

 

 

Thanks in advance.

 

Shailesh

Can anybody tell me the difference betwwen the two classes and the 4 components with examples?..i looked into the documentation...but the information provided seems too less...

 

 

Thanks in Advance.

Hi,

 

I have a case where i need to process an opportunity after 30 business days of its creation (Given the Start Date, No. Of Business days, find End_Date..) . Can anybody suggest the best way to do it using formula?

 

Thanks in advance.

Hi,

 

I have a case where i need to process an opportunity after 30 business days of its creation . 

(Given the Start Date, No. Of Business days, find End_Date..) . Can anybody suggest the best way to do it using formula?

 

Thanks in advance.

HI,

 

I am creating a Meeting request from the Calendar Section on the Home page. As per salesforce documentation, when we create a Meeting request and confirm it, it gets converted into a multi person event.

 

But when I confirm the Meeting, the meeting does not get converted into the multi person event.

 

I debugged and found out that i am having a trigger on Event object which is referring to the Start Date & End Date fields on the event object. Hence I am getting an error while i confirm the meeting, as the Start Date and End Date fields on the event during conversion are Null.

 

But then if i comment out those 2 statements from the code, an event is created on conversion. What is weird here is that the Start Date and End Date fields on event are populated with the value of Meeting's Start and End date Time. So i dont understand, why is the value shown as null when the trigger is fired.

 

Can anybody help me with this? OR can anybody provide me what fields of Meeting are Mapped into event on conversion as i dont find any documentation on this. Also is there any way by which we can identify whether the event is a created manually or from Meeting Request?

 

Thanks,
Shailesh.

Hello all,

Please review the code below, I don't get why its not passing 100%

Trigger:
trigger CreateFlightItinerary on Opportunity (after update) {    
List<Itinerary__c> fi = new List<Itinerary__c>();
    for (Opportunity a: Trigger.New)
         if (a.fi_automation_check__c == TRUE){
                 fi.add (new Itinerary__c(
                     Flight_Booking__c = a.Id,
					 Stop_1__c = a.Stop1_ID__c,
					 Flight_Crew_1__c = a.CrewM_1_ID__c
				));
         }
   insert fi;
}

Test:
 
@isTest
private class testCreateFlightItinerary{
    static TestMethod void myTestClass()
    {
    	Account a = new Account();
	    a.Name = 'TestName';
	    a.Phone = '5512991224391';
        insert a;

    	Opportunity o = new Opportunity();
	    o.Name = 'TestName';
            o.AccountID = a.Id;
            o.closedate = system.today();
            o.stagename = 'Sample Quote';
            o.Aircraft_Type__c = 'King Air';
            o.fi_automation_check__c=True;
        insert o;             
    }
}

I get not coverage on the highlight line "fi.add (new Itinerary__c("


Thankss!!

Ronaldo.
The challenge is:

You've been given a requirement to keep Contact addresses in sync with the Account they belong to. Use Process Builder to create a new process that updates all child Contact addresses when the address of the Account record is updated. This process:Can have any name.
Must be activated.
Must update Contact mailing address fields (Street, City, State, Post Code, Country) when the parent Account shipping address field values are updated.

I start with Accounts when records is created or edited.
Filter criteria where accounts shipping address (street, city, state, zip code) is changed (used "or" logic).

I am stuck on the next step "add action".  I started with action type "Update Records".
On objects, I can't seem to change Accounts to Contacts.  Why?
Hi all,

using the IF formula:  I keep receiving a missing ')' syntax error.   what am i doing incorrectly?   thanks
IF(ISPICKVAL(StageName, "nurture", IMAGE("<URL>"),
IF(ISPICKVAL(StageName, "sent to sales",IMAGE("<URL>"),
IF(ISPICKVAL(StageName, "proposal",IMAGE("<URL>"),
IF(ISPICKVAL(StageName, "Returned",IMAGE("<URL>"),
)
)
)
)
 
I am trying to send emails from my apex class in my developer edition of salesforce. Here is the apex code:

    public void sendEmail(Contact con) {
        try {            
            Messaging.reserveSingleEmailCapacity(1); // Reserve email message from capacity
            
            Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage(); // Instantiate new email message
            
            mail.setToAddresses(new String[]{con.Email}); // Set to address to contact's email
            mail.setUseSignature(false); // Don't use signature
            
            /* Set reply to and from address based on if this is a conference email or not */
                
                mail.setReplyTo('myEmail@yahoo.com');
                mail.setOrgWideEmailAddressId('0D2o0000000Ce18'); 
            
            /* Set subject/body if conference confirmation email */
                
                mail.setSubject('Test');
                mail.setHtmlBody('This worked');
                
            /* Set subject/body if companion confirmation email */
             
            
            Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail }); // Send email'
            System.debug('Sent the Email');
            
        /* Display error message if email send was not successful */
        } catch (DmlException e) {
            
            System.debug('The following exception has occurred: ' + e.getMessage());
        }
    }

The issue is that I never recieve the email. I checked the debug logs and they show this:


20:23:59.089 (89826472)|SYSTEM_METHOD_ENTRY|[65]|Messaging.sendEmail(List<Messaging.Email>) 20:23:59.098 (98211855)|EMAIL_QUEUE|[65]|replyTo: charliecox17@yahoo.com, subject: NUBS Conference Confirmation, bccSender: false, saveAsActivity: true, useSignature: false, toAddresses: [charliecox2306@gmail.com], htmlBody: This worked, 20:23:59.098 (98263315)|SYSTEM_METHOD_EXIT|[65]|Messaging.sendEmail(List<Messaging.Email>) 20:23:59.098 (98283765)|SYSTEM_METHOD_ENTRY|[66]|System.debug(ANY) 20:23:59.098 (98300704)|USER_DEBUG|[66]|DEBUG|Sent the Email

Which makes me believe that the email is sending, I am just not recieving it. I have checked my spam folder and tried sending it to multiple emails with no luck. Also my access setting for deleverability is set to all email.

Thanks for any help!
 
I'm just trying to update a lookup field value (Campagna_Account__c) on Account object using a trigger that should update it getting the value from a custom object (Sottocampagna__c).
I think the query is right because it runs well on Force.com Explorer, so I think the problem is somewhere else.

Here's the error line displayed when trigger fires:

data changed by trigger for field Campagna: id value of incorrect type: a06250000004FDNAA2

Here's my code:
trigger PopolaCampagna on Account (before insert, before update) {

Sottocampagna__c var = [
SELECT Campagna__r.Id
FROM Sottocampagna__c
WHERE Name='Segugio'

];

for (Account a: Trigger.new) {
a.Campagna_Account__c = var.Id;
   }
}
Thank you for helping me!

 
Hi all,

Base on my code below, how can I programmatically decide whether or not the current user session is in the service cloud console?

I would like the user to be able to got to this link and have it render in console or regular; https://cs7.salesforce.com/apex/Launcher?txnID=a0AM0000004P7Se

................
Page (Page name = Launcher)
................
<apex:page controller="LauncherController" action="{!processRequest}">

</apex:page>
................
Controller
................
public class LauncherController{
    private String transactionID{get;set;}

    public LauncherController(){

    transactionID = ApexPages.currentPage().getParameters().get('txnID');

    }//end-method

    public PageReference processRequest(){ 

    PageReference pageRef;  

    // if console

    pageRef = new PageReference('https://cs7.salesforce.com/console#%2F' + transactionID);

    // else

    //pageRef = new PageReference('https://cs7.salesforce.com/' + transactionID);

    // end-if

    if(transactionID==null){
      return pageRef;
    }
    return pageRef;
    }
}
Has anyone created code to implement a custom field on tasks that creates a date and time stamp when it is saved as complete?  
Hi Friends,
I am facing one small issue. I am trying to generate a reports from the contact object. When i run the report without ANY Filter conditions it is giving me a only 50 records but when i run a query on my contacts it has more than 5k+ records.

Can you please tell me why my reports are getting less records?

Thanks in advance!
Hi all,

Through Test class is it possible to update the record?
if possible please send me a peace of code.

Thanks
kumar
  • March 04, 2015
  • Like
  • 0
Hi,

I am trying to populate TO field in Email author as Account Name in a Custom Object. But To field is populating as blank. Below is the code sample. Kindly Help!!!!
/***Account_1_Id__c(getting account id) is a formula field on Offer__c and Account is lookup in Offer__c*****/


('/_ui/core/email/author/EmailAuthor?/p2_lkid={!Offer__c.Account_1_Id__c}&rtype=003&retURL=%2F{!Offer__c.Id}&p3_lkid={!Offer__c.Id}');

Regards,
Animesh
Hi,

I am trying to wirte a query in apex class to get the list of cases created between last 24 hours.
I tried following and nothing works. Every query gives some or the other syntax errors.

SELECT ID from Cases WHERE CreateDate = LAST 1 DAYS

SELECT ID from Cases WHERE CreateDate > NOW()-1 and CreateDate < NOW()

SELECT ID from Cases WHERE CreateDate > TODAY()-1 and CreateDate < TODAY()

I also tried - Cases c = new Cases [CreateDate = TODAY()];

Also I want to store ID, either in string array or list. (Sorry I am new to Apex).
Please suggest what I am doing wrong and possible solution.

-Sanjay
Hello-

I am getting a URL No Longer Exists error when trying to delete an Apex Class.  When I click the delete button on the class it tells me that there are 4 apex jobs still referencing the class:

User-added image
Then when I click one of the 'Apex Job' links to try and resolve the issue I get the URL No Longer Exists error:

User-added image
I have scheduled a job for this specific class a few times, but have deleted the scheduled job (there is nothing referencing the class currently, I should be able to delete it).  Please let me know if you have any ideas for workarounds so that I can get this class deleted.

 
This link:
https://help.salesforce.com/apex/HTViewSolution?urlname=Spring-15-Access-Address-and-Geolocation-Compound-Fields-Using-Apex&language=en_US

says I can access Address compound fields from Apex.  I can access Account address fields but on Leads I get the error "Invalid field Address for SObject Lead".  This error when my trigger runs.  There is no error in the Developer console.  Not sure if this is by design or if I amdoing something wrong.  

I have tried just referencing the field, assigning the field to an Address type field, and looking it up in a SOQL query.  I can look the field up in the Execute Anonymous console and it works fine.

Any idea what I am doing wrong?  

Thanks!!
I want add a lookup field to the opportunity object to display the email of the contact.

Currently, I'm using contact__r.email as the reference, but this is not displaying any information for existing contact.

How can I make this work?

Thanks,
Jason
Hi folks,

Is it possible to set a value to the Rollup summary field through Apex?
Hi Guys,

Is it possible to change the owner of the record through Apex code? If so, how to achieve it?

The salesforce.com docs states remoting methods can take the following values as arugments, "primitives, collections, typed and generic sObjects, and user-defined Apex classes...". There appears to be an issue with generic sObject. Take a look at the following Visualforce page and the related remoting method.

 

<apex:page showHeader="true" sidebar="true" controller="RemotingSObject">
	<input value="Click Me" onclick="doRemote();" type="button"/>

	<script type="text/javascript">
		
		function doRemote(){
			var obj = {
				sobjectType: 'Account',
				Name: 'My new account'
			};

			//You can see there is a value of sbojectType set
			console.log(obj);

			Visualforce.remoting.Manager.invokeAction('{!$RemoteAction.RemotingSObject.receiveSObject}', obj, function(result, event){
		        console.log(event);
		        console.log(result);
			});
		}

	</script>
</apex:page>

 The Class:

public with sharing class RemotingSObject {
	@RemoteAction
	public static void receiveSObject(SObject obj) {
		system.debug(obj); 
	}
}

 If you look in the browsers JavaScript console you will see this error message:

Visualforce Remoting Exception: Unable to determine SObject type: SObject. Please provide an 'id' or 'sobjectType' value.

 

Makes no sense as an sobjectType value is being supplied. Oddly enough if you provide an id value it works...but if you are trying to insert a new sObject you do not yet have an id value to use.

 

Any ideas on how to make this work? Bug?

 

Thanks,

Jason

 

  • February 05, 2013
  • Like
  • 1