• Puru Annamalai
  • NEWBIE
  • 75 Points
  • Member since 2015

  • Chatter
    Feed
  • 3
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 11
    Replies
i written the trigger for auto create event from custom object, below is my code

trigger AutoCreateSfdcEvent on SVMXC__SVMX_Event__c (after insert , after update ) {
     List<Event> lstevent = new List<Event>();
   for(SVMXC__SVMX_Event__c se : Trigger.New){
     if(Trigger.IsAfter && Trigger.IsInsert){
      Event e = new Event();  
       e.StartDateTime = se.SVMXC__StartDateTime__c;
       e.EndDateTime = se.SVMXC__EndDateTime__c;
       e.Subject = se.Name;
       e.OwnerId=se.Owner.id;
       e.WhatId=se.id;
     //  e.AssignedTo= se.SVMXC__Technician__c.id;
       //e.WhatId = se.SVMXC__WhatId__c;
       //e.WhoId = se.SVMXC__WhoId__c;            
          lstevent.add(e);
     }
   }
    Insert lstevent;  
}

so,I am getting error message. while record is creating in custom object                              "Review all error messages below to correct your data.
Apex trigger AutoCreateSfdcEvent caused an unexpected exception, contact your administrator: AutoCreateSfdcEvent: execution of AfterInsert caused by: System.DmlException: Insert failed. First exception on row 0; first error: INVALID_CROSS_REFERENCE_KEY, Assigned To ID: owner cannot be blank: [OwnerId]: Trigger.AutoCreateSfdcEvent: line 17, column 1
"

Any body help me asap... Thanks....
I have an action 'hello1' on an apex command button 'Cancel'. On clicking Cancel I want to navigate back to the particular Order record whose survey record I am capturing at present. URL of the current survey page is 
https://c.ap2.visual.force.com/apex/TakeSurvey?id=a0R28000000ChcAEAS&cId=801280000004CYc

VF Code
<apex:page standardcontroller="Survey__c" extensions="ViewSurveyController" cache="false" sidebar="false" showheader="false">
<apex:commandButton action="{!hello1}"  value="Cancel"/>
</apex:page>

Apex Class
public PageReference hello1() {
        orderId = Apexpages.currentPage().getParameters().get('cId');
        PageReference reference=new PageReference('https://c.ap2.visual.force.com/801/o?{!Order.Id}=orderId');
        reference.setRedirect(true);
        return reference; 
    }

But 
'https://c.ap2.visual.force.com/801/o?{!Order.Id}=orderId'
is not navigating me back to particular record, rather to the whole list of Order Records. Kindly help.
 
Is this a bug or am i missing something?

I have a tabPanel and 2 Tabs within the Panel (tabEmpty and tabChart). Unless i have the tabPanel point (eg set selectedTab="tabChart" ) to the Tab with the Chart in it, tabChart, the chart won't show up (it actually shows up but crammed way up into the left corner with just a few pixels showing.)

What am i missing? If you change the selectedTab to tabChart, you'll see it correctly.
Here's the code:

**********the page***************
<apex:page controller="PieChartController" title="Pie Chart">
    <apex:tabPanel switchType="client" selectedTab="tabEmpty" id="AccountTabPanel">
 
    <!--    **************Empty Tab *********************************-->
    <apex:tab label="Empty Tab" name="tabEmpty" id="tabEmpty">
    </apex:tab>

    <!--    **************Tab with a Chart***************************-->
    <apex:tab label="Chart Tab" name="tabChart" id="tabChart">
        <apex:chart resizable="true" height="350" width="450" data="{!pieData}">
            <apex:pieSeries dataField="data" labelField="name"/>
            <apex:legend position="right"/>
        </apex:chart>
    </apex:tab>
    
    </apex:tabPanel>    
</apex:page>


**********and the PieChartController controller***************
public class PieChartController {
    public List<PieWedgeData> getPieData() {
        List<PieWedgeData> data = new List<PieWedgeData>();
        data.add(new PieWedgeData('Jan', 30));
        data.add(new PieWedgeData('Feb', 15));
        data.add(new PieWedgeData('Mar', 10));
        data.add(new PieWedgeData('Apr', 20));
        data.add(new PieWedgeData('May', 20));
        data.add(new PieWedgeData('Jun', 5));
        return data;
    }

    // Wrapper class
    public class PieWedgeData {

        public String name { get; set; }
        public Integer data { get; set; }

        public PieWedgeData(String name, Integer data) {
            this.name = name;
            this.data = data;
        }
    }
}
Hi,

I have 2 VF pages, page1 is parent, page2 is child.

If i execute the page1, the constructor,action method,action function is called perfectly in page1, but the child page( page2 ) invokes only the constructor & action function, it missed the page action method, what would be the reason ?

i think it is something related to execution order, am i right, if yes, kindly post the execution order for this scenario ?

PAGE1:
<apex:page standardController="Account" extensions="page1con" action="{!page1Action}">
  
  <apex:form>
      <apex:actionFunction name="callAction" action="{!callAction}" reRender="block" status="statusblock"/> 
  </apex:form>
  
      <apex:outputPanel id="block">
          [ PAGE1 ]
          {!output}
          <apex:actionStatus id="statusblock" startText="Loading..." stopText=""/>
          <apex:include pageName="Page2" rendered="{!showit}"/>
      </apex:outputPanel>
      
      <script>
          window.setTimeout(callAction,500);
      </script>
 
</apex:page>

PAGE1 Controller:
public class page1con{
    
    public boolean showit{get;set;}
    public String output{get;set;}
    
    public page1con(ApexPages.StandardController controller) {
        output = ' -> page1 Constructor';
        showit=false;
    }

    public void callAction() {
        output += ' -> page1 Onload Action Function';
        showit = true;
    }
    
    public void page1action() {
        output += ' -> page1 Page Action';
    }

}

PAGE 2:
<apex:page standardController="Account" extensions="page2con" action="{!page2Action}" showHeader="false">
 
 <apex:form>
      <apex:actionFunction name="callAction" action="{!callAction}" reRender="block" status="statusblock"/>
 </apex:form>
 
 <script>
           window.setTimeout(callAction,500);
 </script>
 
      <apex:outputPanel id="block">
          [ PAGE2 ]
          {!output}
          <apex:actionStatus id="statusblock" startText="Loading..." stopText=""/>
      </apex:outputPanel>
 
</apex:page>

PAGE2 Controller
public class page2con{

    public string output{get;set;}
    
    public page2con(ApexPages.StandardController controller) {
        output=' -> page2 Constructor';
    }
    
    public void callAction() {
        output += ' -> page2 Onload Action Function';
    }
    
    public void page2action() {
        output += ' -> page2 Page Action';
    }

}

OUTPUT
[ PAGE1 ] -> page1 Constructor -> page1 Page Action -> page1 Onload Action Function
[ PAGE2 ] -> page2 Constructor -> page2 Onload Action Function


 
I want to send an SSL Encrypted(using certificates) callout from Salesforce to my java application which runs in Tomcat Server locally in my windows machine.

From the Salesforce, i can't send an callouts to localhost, i can send only to the domains which is publicly available in internet, so how do i (Salesforce) access my tomcat localhost application from the internet.

Host file configurations, proxy servers  works only inside my system, but i want it to be on public, how do i start with this, i know about the SSL Certification creation,signing process and all, need idea about the how to make my localhost app public in internet, kindly give your suggestions.

Thanks in Advance !!!
Hi,

I am trying to read the array list of a web service response.
Lets say this is my web service declaration.
FAMExternalWebservice.SumbitReleaseFromThirdParty stub = new FAMExternalWebservice.SumbitReleaseFromThirdParty();
and this is to call the web service method generated from the wsdl2apex
FAMExternalWebservice.ArrayOfGenericListItem insurers = stub.GetSalesForceInsurersDDL();
This would return an arraylist of insurers.
I want to now put this in a map or list which I can read from?

Thanks 

 
Hi,

I have created a custom button in the case which opens up a visual force page to list all contacts in the account of the current case.  Is there a way to change these contact name into a link whereby on clicking, I can change the case contact?

My Visual Force Page:

<apex:page standardController="account" showHeader="false" sidebar="false">
<apex:pageBlock >
<apex:pageBlockTable value="{! account.contacts}" var="item">
    <apex:column value="{! item.name}"/>
    <apex:column value="{! item.email}"/>

</apex:pageBlockTable>
</apex:pageBlock>
</apex:page>

Screen shot for my list contact button as below:

User-added image

Cheers,
Chris
i written the trigger for auto create event from custom object, below is my code

trigger AutoCreateSfdcEvent on SVMXC__SVMX_Event__c (after insert , after update ) {
     List<Event> lstevent = new List<Event>();
   for(SVMXC__SVMX_Event__c se : Trigger.New){
     if(Trigger.IsAfter && Trigger.IsInsert){
      Event e = new Event();  
       e.StartDateTime = se.SVMXC__StartDateTime__c;
       e.EndDateTime = se.SVMXC__EndDateTime__c;
       e.Subject = se.Name;
       e.OwnerId=se.Owner.id;
       e.WhatId=se.id;
     //  e.AssignedTo= se.SVMXC__Technician__c.id;
       //e.WhatId = se.SVMXC__WhatId__c;
       //e.WhoId = se.SVMXC__WhoId__c;            
          lstevent.add(e);
     }
   }
    Insert lstevent;  
}

so,I am getting error message. while record is creating in custom object                              "Review all error messages below to correct your data.
Apex trigger AutoCreateSfdcEvent caused an unexpected exception, contact your administrator: AutoCreateSfdcEvent: execution of AfterInsert caused by: System.DmlException: Insert failed. First exception on row 0; first error: INVALID_CROSS_REFERENCE_KEY, Assigned To ID: owner cannot be blank: [OwnerId]: Trigger.AutoCreateSfdcEvent: line 17, column 1
"

Any body help me asap... Thanks....
Hello Guys,
                I have wrote a trigger on account object that  whenever a user enter duolicate  phone number or email then it will show an error on page and the info will not stored in the account object.
Here is the code
trigger AccountTrigger on Account (before insert, before update)
{
    //Account duplicate protection system.
    if (Trigger.isBefore && (Trigger.isInsert || Trigger.isUpdate))
    {
        Map<String, Account> anAccountMap = new Map<String, Account>();
        for (Account anAccount : System.Trigger.new)
        {
            // Make sure we don't treat an mobile phone that  
            // isn't changing during an update as a duplicate.  
            if ((anAccount.Phone != null) && (Trigger.isInsert || 
                      (anAccount.Phone != Trigger.oldMap.get(anAccount.Id).Phone)))
            {
                // Make sure another new Account isn't also a duplicate  
                if (anAccountMap.containsKey(anAccount.Phone))
                {
                    anAccount.Phone.addError('Another new Account has the same mobile phone.');
                    System.debug('*** Error: found account with dublicate mobile phone: ' + anAccount);
                } else
                {
                    anAccountMap.put(anAccount.Phone, anAccount);
                }
            }
        }  
        // Using a single database query, find all the Accounts in  
        // the database that have the same mobile phone as any  
        // of the Accounts being inserted or updated.  
        for (Account aDBAccount : [SELECT Phone FROM Account WHERE Phone IN :anAccountMap.KeySet()])
        {
            Account newAccount = anAccountMap.get(aDBAccount.Phone);
            newAccount.Phone.addError('An Account with this mobile phone already exists.');
            System.debug('*** Error: found account with dublicate mobile phone: ' + newAccount);
        }
    }
}
Note:-- The thing is that its working but  its not showing any erorr on my particular page. Any help from the MVP's or the consultant  will be great.
Thanx
 
  • March 23, 2015
  • Like
  • 0
Hello,
we are experiencing an code coverage problem on our production environment. Last week we deployed an change set without any issues and the code coverage was at 75%. 3 days later we tried to deploy an other change set, but this has failed do to code coverage error. The code coverage is now at 73%. The problem is, this change contains no code and is only an flow.
There were no changes to any code in those 3 days and no changes to validation rules or work-flows (checked via audit trail), all tests succeed, the only problem is in the coverage. We are generating our test data via factories and using seeAllData=false and aren't using any record in the org for testing.
The code coverage was at 75% at the time of the deployment of the first change set, it would not deploy otherwise. How is is possible, that it is only 73 now?
Classes recompiled, test history deleted, we get the 73% when deploying or running all tests(UI and IDE).

I have found this issue on the forums
https://success.salesforce.com/issues_view?id=a1p30000000T1m1AAC
and have checked the ApexCodeCoverageAggregate, but there is no problem.

I have even tried to validate an change set containing 600 lines of i++; (I know, ugly) and haven't got even 1% more coverage. We are currently using about 2M chars of code.

This is an blocker for us, any help would be appreciated.

Thanks.
Hello ,
         I have one object Project__c . In this there are one  picklist Assigned_To__c  in this picklist i add manually all user name. So whenever i choose for example Pritam Shekhawat then project owner should be Pritam Shekhawat. Give me a idea what is easy way to do this.
Thanks
I have an action 'hello1' on an apex command button 'Cancel'. On clicking Cancel I want to navigate back to the particular Order record whose survey record I am capturing at present. URL of the current survey page is 
https://c.ap2.visual.force.com/apex/TakeSurvey?id=a0R28000000ChcAEAS&cId=801280000004CYc

VF Code
<apex:page standardcontroller="Survey__c" extensions="ViewSurveyController" cache="false" sidebar="false" showheader="false">
<apex:commandButton action="{!hello1}"  value="Cancel"/>
</apex:page>

Apex Class
public PageReference hello1() {
        orderId = Apexpages.currentPage().getParameters().get('cId');
        PageReference reference=new PageReference('https://c.ap2.visual.force.com/801/o?{!Order.Id}=orderId');
        reference.setRedirect(true);
        return reference; 
    }

But 
'https://c.ap2.visual.force.com/801/o?{!Order.Id}=orderId'
is not navigating me back to particular record, rather to the whole list of Order Records. Kindly help.
 
hiii
i want to create a vf page on which i have two object one opportunity and task.
i have created the vf and controller bt i m facing the problem that how to a fetch the value of opportunity and on those opportunity we have task i a single query.
i m not abe to create a relationship query .Can anyone please help me 
Is this a bug or am i missing something?

I have a tabPanel and 2 Tabs within the Panel (tabEmpty and tabChart). Unless i have the tabPanel point (eg set selectedTab="tabChart" ) to the Tab with the Chart in it, tabChart, the chart won't show up (it actually shows up but crammed way up into the left corner with just a few pixels showing.)

What am i missing? If you change the selectedTab to tabChart, you'll see it correctly.
Here's the code:

**********the page***************
<apex:page controller="PieChartController" title="Pie Chart">
    <apex:tabPanel switchType="client" selectedTab="tabEmpty" id="AccountTabPanel">
 
    <!--    **************Empty Tab *********************************-->
    <apex:tab label="Empty Tab" name="tabEmpty" id="tabEmpty">
    </apex:tab>

    <!--    **************Tab with a Chart***************************-->
    <apex:tab label="Chart Tab" name="tabChart" id="tabChart">
        <apex:chart resizable="true" height="350" width="450" data="{!pieData}">
            <apex:pieSeries dataField="data" labelField="name"/>
            <apex:legend position="right"/>
        </apex:chart>
    </apex:tab>
    
    </apex:tabPanel>    
</apex:page>


**********and the PieChartController controller***************
public class PieChartController {
    public List<PieWedgeData> getPieData() {
        List<PieWedgeData> data = new List<PieWedgeData>();
        data.add(new PieWedgeData('Jan', 30));
        data.add(new PieWedgeData('Feb', 15));
        data.add(new PieWedgeData('Mar', 10));
        data.add(new PieWedgeData('Apr', 20));
        data.add(new PieWedgeData('May', 20));
        data.add(new PieWedgeData('Jun', 5));
        return data;
    }

    // Wrapper class
    public class PieWedgeData {

        public String name { get; set; }
        public Integer data { get; set; }

        public PieWedgeData(String name, Integer data) {
            this.name = name;
            this.data = data;
        }
    }
}