• Nagesh E
  • NEWBIE
  • 5 Points
  • Member since 2011
  • Manager, CRM Development
  • Insulet

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 20
    Questions
  • 11
    Replies
How can I use string as condition. For example I will strore Name=="Sam"  in database and use this string in class to check this condition

 <apex:commandLink action="http://www.apple.com/privacy/" value="Insulet Corporation HIPAA  Privacy Notice " styleClass="normalColor" target="_blank"/> 

when I click on button it is taking to Relative URL:

http://insulet.test.cs13.force.com/vfpage/%E2%80%8B/%E2%80%8B/%E2%80%8Bwww.apple.com/%E2%80%8Bprivacy/

Conga template not showing any template if I login as a User, If I login as me it is showing all the templates. Any thoughts. I am not using any reports.

public class AccountProfileFormExtention {
   
   public List<Visit_Report__c> visitReports,visitReportsAdd;
   public Visit_Report__c vReports,vReportsAdd; 
   set <id> acc1;   
   public Boolean nextdisplay=true;
   public Boolean savedisplay=true;
   public List<vAccounts> accountBussPlanList {get; set;}
   public List<vAccountsWO> accountBussPlanListWO {get; set;}
   List<Account> selectedAccounts = new List<Account>();
   List<Opportunity> selectedContacts = new List<Opportunity>();
  
   public Boolean getNextdisplay(){return nextdisplay;}
   public Boolean getSavedisplay(){return savedisplay;}
   
   public AccountProfileFormExtention(ApexPages.StandardController controller) {
         visitReports=getvisitReports();
     }
  /* public Visit_Report__c getvisitReportsAdd() {
      if(vReportsAdd == null)
         vReportsAdd = new Visit_Report__c();
      return vReportsAdd;
   }*/
   
   public PageReference getSelected(){
     
      for(vAccountsWO cCon1 : getnewAcctWO()) {
           selectedAccounts.clear();
           if(cCon1.selected == true) {
                 selectedAccounts.add(cCon1.acc);
            }
        }   
     return null;
    } 
      
    public Pagereference onLoad()
    {
      try{
            if(accountBussPlanList == null) {
       String currentQuater = ThisQuater();
             accountBussPlanList = new List<vAccounts>();
            
             List<Account> acc = new List<Account>();
             acc1 = new set <id>(); 
             
             Profile p= [Select Name, Id From Profile  where Name like 'Clinical Specialist'];
             if(UserInfo.getProfileId() == p.id){
                TerritoryManagement__c t = [Select Id From TerritoryManagement__c  where ClinicalSpecialistId__c=: UserInfo.getUserId() and IsActive__c= true Limit 1];
                acc = [SELECT id from Account where Target_Account__c = true and TerritoryManagementId__c =: t.Id];
             } 
             else {
                TerritoryManagement__c t = [Select Id From TerritoryManagement__c  where TerritoryManagerId__c=: UserInfo.getUserId() and IsActive__c= true Limit 1]; 
                acc = [SELECT id from Account where Target_Account__c = true and TerritoryManagementId__c =: t.Id];
             }  
             for(Integer i=0;i<acc.size();i++) {
              acc1.add(acc[i].Id);
             }
                        
            if(acc.size()>0){
                 for(Opportunity accBusPlan : [SELECT id,Sales_Account__c,Name from Opportunity where Sales_Account__c in: acc and Name like : currentQuater  ]) 
               {  accountBussPlanList.add(new vAccounts(accBusPlan));
               acc1.remove(accBusPlan.Sales_Account__c);
               }
              
             }   
             else {
               nextdisplay=false;
          savedisplay=true;
             }               
             
            }  
      }
      catch(Exception e)
      {
        ApexPages.addMessages(e);
        nextdisplay=false;
        savedisplay=false;
      }         
      return null;
    } 
      
    public List<vAccounts> getnewAcct(){
          return accountBussPlanList;
    }
    
    public List<vAccountsWO> getnewAcctWO(){
            if(acc1 != null) {
            accountBussPlanListWO = new List<vAccountsWO>();
          
             for(Account accBusPlan : [SELECT id,Name from Account where Id in: acc1 ]) {
                          accountBussPlanListWO.add(new vAccountsWO(accBusPlan));
             }                  
           }           
       return accountBussPlanListWO;
    }
    
    public PageReference processSelected() {
  
   for(vAccounts cCon : getnewAcct()) {
           if(cCon.selected == true) {
                selectedContacts.add(cCon.opp);
            }
        }
 
        for(vAccountsWO cCon1 : getnewAcctWO()) {
            
           if(cCon1.selected == true) {
                 selectedAccounts.add(cCon1.acc);
            }
        }     
        return  new PageReference('/apex/AccountPlanAdd');
    }
        
     public class vAccounts {
        public Opportunity opp {get; set;}
        public Boolean selected {get; set;}

        //This is the contructor method. When we create a new cContact object we pass a Contact that is set to the con property. We also set the selected value to false
        public vAccounts(Opportunity o) {
            opp = o;
            selected = true;
        }
    }
    
      public class vAccountsWO {
        public Account acc {get; set;}
        public Boolean selected {get; set;}

        //This is the contructor method. When we create a new cContact object we pass a Contact that is set to the con property. We also set the selected value to false
        public vAccountsWO(Account a) {
            acc = a;
            selected = true;
        }

 

 

VF Page:

 

<apex:page standardController="Visit_Report__c"
    extensions="AccountProfileFormExtention" action="{!onLoad}">
     <apex:pagemessages />
    <apex:form >
        <apex:pageBlock title="Accounts with Business Plans">

            <apex:pageBlockButtons >
                <apex:commandButton action="{!processSelected}" value="Next" rendered="{!nextdisplay}"/>
                <apex:commandButton action="{!saveAndAddVisitReports}" value="Create" rendered="{!savedisplay}"/>
            </apex:pageBlockButtons>
            
             <apex:pageBlockSection title="Accounts with Business Plans">
            <apex:pageBlockTable value="{!newAcct}" var="selectedAcc" rendered="{!(newAcct.size != 0)}">
                
                    <apex:column >
                        <apex:facet name="header">
                            <apex:inputCheckbox onclick="checkAll(this,'checkedone')" />
                        </apex:facet>
                        
                        <apex:inputCheckbox value="{!selectedAcc.selected}" id="checkedone">
                        </apex:inputCheckbox>
                    </apex:column>
                    
                    <apex:column >
                    <apex:facet name="header">Account</apex:facet>
                    <apex:outputField value="{!selectedAcc.opp.Sales_Account__c}" />
                </apex:column>

                <apex:column >
                    <apex:facet name="header">Account Business Plan Name</apex:facet>
                    <apex:outputField value="{!selectedAcc.opp.Name}" />
                </apex:column>
                  
            </apex:pageBlockTable>
             <apex:outputText rendered="{!(newAcct.size = 0)}" value="There are no reocrds to display." />
            </apex:pageBlockSection>  
            
              
            <apex:pageBlockSection title="Accounts with out Business Plans">
           <apex:pageBlockTable value="{!newAcctWO}" var="selectedAccWO" rendered="{!(newAcctWO.size != 0)}">
                                          
           <apex:column >
                        <apex:facet name="header">
                            
                        </apex:facet>
                       <apex:inputCheckbox value="{!selectedAccWO.selected}" id="checkeSec">
                       
                        </apex:inputCheckbox>
                    </apex:column> 
                   
                 <apex:column >
                 <apex:facet name="header">Account</apex:facet>
                 <apex:outputField value="{!selectedAccWO.acc.Name}" />
                 </apex:column>
             
           </apex:pageBlockTable> 
            <apex:outputText rendered="{!(newAcctWO.size = 0)}" value="There are no reocrds to display." />
            </apex:pageBlockSection>
            
           
            
         </apex:pageBlock>
        <script type="text/javascript">
    function checkAll(cb,cbid)
        {
            var inputElem = document.getElementsByTagName("input");                     
            for(var i=0; i<inputElem.length; i++)
            {             
                 if(inputElem[i].id.indexOf(cbid)!=-1){                                        
                    inputElem[i].checked = cb.checked;
                }
            }
        }
</script>
        

    </apex:form>

</apex:page>


passing Related contact info using Java script though Button click. Error is coming when there is multiple contacts with the same name. 

 

Tony Abbate  Tony Abbate  Tony Abbate  TONY ABBATE  TONY ABBATE  Tony Abbate  Tony Abbate  Tony Abbate  Tony Abbate  Tony Abbate  Tony Abbate  Tony Abbate Error: Multiple items found. Select from drop-down or click icon to refine search.

Related Contact--None--Tony Abbate 



I am able to get all the Id's problem is it has more than 10 Id and I need to do a callout for each and every Id

I need to go for BulkCallout but bulk is supporting only 1 callout ,is there any way that i can do a callout outside and get all the Id's and pass those id's to Bulk class

 

@Future(callout=true) 

public static void updateAccount() {
    //construct an HTTP request    HttpRequest req = new HttpRequest();    req.setEndpoint('https://api.yourmembership.com'); 

  req.setMethod('GET'); 

  req.setBody('<?xml version="1.0" encoding="utf-8" ?><YourMembership><Version>1.70</Version><ApiKey>XXXXXXXXXXXXXXX</ApiKey><CallID>1</CallID><SaPasscode>XXXXXXX</SaPasscode><Call Method="Sa.NonMembers.All.GetIDs"></Call></YourMembership>'); 

      Http http = new Http();    HttpResponse res = http.send(req);   

Dom.Document doc = res.getBodyDocument();   

Set<string> st = new Set<string>();   

for(dom.XmlNode node : doc.getRootElement().getChildElements()) {    if(node.getName()=='Sa.NonMembers.All.GetIDs') {  for(dom.XmlNode node2 :node.getChildElements())  {  if(node2.getName()=='NonMembers'){  for(dom.XmlNode node3 :node2.getChildElements()){    st.add(node3.getText());  }    }   }      }}

 

this is the other callout..

HttpRequest reqP = new HttpRequest();    reqP.setMethod('GET');    reqP.setEndpoint('https://api.yourmembership.com');   

reqP.setBody('<?xml version="1.0" encoding="utf-8" ?><YourMembership><Version>1.70</Version><ApiKey>xxxxxxx</ApiKey><CallID>'+CallId+'</CallID>

<SaPasscode>xxxxxx</SaPasscode>

<Call Method="Sa.People.Profile.Get">

<ID>'+listStrings[i]+'</ID>

</Call></YourMembership>'); 

  Http httpP = new Http();   

HttpResponse resP = httpP.send(reqP);   

Dom.Document docP = resP.getBodyDocument();    

 



I am able to get all the Id's problem is it has more than 10 Id and I need to do a callout for each and every Id

I need to go for BulkCallout but bulk is supporting only 1 callout ,is there any way that i can do a callout outside and get all the Id's and pass those id's to Bulk class

 

@Future(callout=true) 

public static void updateAccount() {
    //construct an HTTP request    HttpRequest req = new HttpRequest();    req.setEndpoint('https://api.yourmembership.com'); 

  req.setMethod('GET'); 

  req.setBody('<?xml version="1.0" encoding="utf-8" ?><YourMembership><Version>1.70</Version><ApiKey>XXXXXXXXXXXXXXX</ApiKey><CallID>1</CallID><SaPasscode>XXXXXXX</SaPasscode><Call Method="Sa.NonMembers.All.GetIDs"></Call></YourMembership>'); 

      Http http = new Http();    HttpResponse res = http.send(req);   

Dom.Document doc = res.getBodyDocument();   

Set<string> st = new Set<string>();   

for(dom.XmlNode node : doc.getRootElement().getChildElements()) {    if(node.getName()=='Sa.NonMembers.All.GetIDs') {  for(dom.XmlNode node2 :node.getChildElements())  {  if(node2.getName()=='NonMembers'){  for(dom.XmlNode node3 :node2.getChildElements()){    st.add(node3.getText());  }    }   }      }}

 

this is the other callout..

HttpRequest reqP = new HttpRequest();    reqP.setMethod('GET');    reqP.setEndpoint('https://api.yourmembership.com');   

reqP.setBody('<?xml version="1.0" encoding="utf-8" ?><YourMembership><Version>1.70</Version><ApiKey>xxxxxxx</ApiKey><CallID>'+CallId+'</CallID>

<SaPasscode>xxxxxx</SaPasscode>

<Call Method="Sa.People.Profile.Get">

<ID>'+listStrings[i]+'</ID>

</Call></YourMembership>'); 

  Http httpP = new Http();   

HttpResponse resP = httpP.send(reqP);   

Dom.Document docP = resP.getBodyDocument();    

 

I am able to get all the Id's problem is it has more than 10 Id and I need to do a callout for each and every Id

I need to go for BulkCallout but bulk is supporting only 1 callout ,is there any way that i can do a callout outside and get all the Id's and pass those id's to Bulk class

 

@Future(callout=true) 

public static void updateAccount() {
    //construct an HTTP request    HttpRequest req = new HttpRequest();    req.setEndpoint('https://api.yourmembership.com'); 

  req.setMethod('GET'); 

  req.setBody('<?xml version="1.0" encoding="utf-8" ?><YourMembership><Version>1.70</Version><ApiKey>XXXXXXXXXXXXXXX</ApiKey><CallID>1</CallID><SaPasscode>XXXXXXX</SaPasscode><Call Method="Sa.NonMembers.All.GetIDs"></Call></YourMembership>'); 

      Http http = new Http();    HttpResponse res = http.send(req);   

Dom.Document doc = res.getBodyDocument();   

Set<string> st = new Set<string>();   

for(dom.XmlNode node : doc.getRootElement().getChildElements()) {    if(node.getName()=='Sa.NonMembers.All.GetIDs') {  for(dom.XmlNode node2 :node.getChildElements())  {  if(node2.getName()=='NonMembers'){  for(dom.XmlNode node3 :node2.getChildElements()){    st.add(node3.getText());  }    }   }      }}

 

this is the other callout..

HttpRequest reqP = new HttpRequest();    reqP.setMethod('GET');    reqP.setEndpoint('https://api.yourmembership.com');   

reqP.setBody('<?xml version="1.0" encoding="utf-8" ?><YourMembership><Version>1.70</Version><ApiKey>xxxxxxx</ApiKey><CallID>'+CallId+'</CallID>

<SaPasscode>xxxxxx</SaPasscode>

<Call Method="Sa.People.Profile.Get">

<ID>'+listStrings[i]+'</ID>

</Call></YourMembership>'); 

  Http httpP = new Http();   

HttpResponse resP = httpP.send(reqP);   

Dom.Document docP = resP.getBodyDocument();    

 

 

I am trying parse below XML.

 

</YourMembership_Response>

<YourMembership_Response>
<ErrCode>0</ErrCode>
<Sa.NonMembers.All.GetIDs>
<ServerGmtBias>-4</ServerGmtBias>
<ServerTime>2011-09-14 12:21:35</ServerTime>
<NonMembers>
<ID>1A482818-D766-4C43-B11E-6BFDE5C79021</ID>
<ID>3457A523-27AD-4436-B303-90C83DF97695</ID>
<ID>CAA0950F-4FE0-4792-8EC0-671841E8F94E</ID>
<ID>7D05F8EF-140D-4548-A87D-6905616ED570</ID>
<ID>B2B9E9E0-BEA2-48F0-81FD-19501A9D7C7B</ID>
<ID>65466DD4-7670-49FF-9E59-05295CC47606</ID>
<ID>C1F264FA-E1F0-4526-B01D-4364CED1A4D1</ID>
<ID>B3656FBE-EC31-4529-9400-E351A135A239</ID>
<ID>0F15329D-B2D8-4348-9295-888B0AC9C36B</ID>
<ID>203730C6-93CD-46EB-948B-B7849D808EFA</ID>
<ID>0690E245-E22D-41C8-9355-189DCE003BE1</ID>
<ID>BDF1D4F1-B3D0-4C3A-B024-A84FBF550CD5</ID>
<ID>F7221900-3B9E-4FE0-9D22-270B9B96F298</ID>
</NonMembers>
</Sa.NonMembers.All.GetIDs> 
I need all the ID's into List.. I am trying to do by using for(Dom.XMLNode child : Body.getChildElements()) which is not returing any thing. I need some ideas how to parse XML 
 
Thanks
NASH

Hi,

I am trying to integrate yourmembership.com with salesforce.

Here is the API link, https://api.yourmembership.com/

I need to get the info regarding all the non member into salesforce.

I was trying the callout after registering endpoint in SFDC.

Some how I am not able to do successfully. Any ideas or working examples how callout methods should be in salesforce.

 

Thanks

Nash

Hi,

I am trying to integrate yourmembership.com with salesforce.

Here is the API link, https://api.yourmembership.com/

I need to get the info regarding all the non member into salesforce.

I was trying the callout after registering endpoint in SFDC.

Some how I am not able to do successfully. Any ideas or working examples how callout methods should be in salesforce.

 

Thanks

Nash

Hi I am trying to attach content document to current opportunity using VF page. I am not sure where I can get the info regarding attachments to opportunity 

 

Thanks

Nash

I need to display chatter follow in pageblock table by taking current user is following or not if not 

Follow or if yes Following or UnFollow kind of message. 

 

Thanks

Nash

I am looking to customize standard Lead Convert page. I need to take out the option "DO Not create Opportunity on Lead Conertion". I am not able to find any solution other than going for custome lead convert page. Is there any other way to do.

Thanks

Nash 

 

trigger opptyCreationonConvert on Lead (after update) {     
    List<Opportunity> o= new List<Opportunity>();    

  for (Lead convertedLead : Trigger.new) {           

      if (convertedLead.IsConverted && convertedLead.ConvertedOpportunityId==null)            {         

              o.add (new Opportunity(                   

    Name = convertedLead.Company,                 

      CloseDate = date.today()+90,           

            AccountId = convertedLead.ConvertedAccountId,     

                  StageName = '1 - Qualification'));                        

          }     }  

  if (!o.isEmpty()) { 

       insert o;   

  }     }

I am looking for best practices for release manager for salesforce life cycle

 

<script type="text/javascript">
{
window.parent.location.href="/{!Contact.Id}/e?retURL=%2F{!Contact.Id}";

if (document.getElementById('name_lastcon2').value == 'Dummy 123')
{
document.getElementById('name_lastcon2').value = '';
}
}

</script>

 

This one is going into infinate loop.. i didnot see anything on the page

trigger TobedeleteContact on Contact (after insert, after update) {
    
    List<Contact> contactToBeDeleted = new List<Contact>();
    Set<Id> ownerIds = new Set<Id>();
   for (Contact c : Trigger.new)
      ownerIds.add(c.OwnerId);
      for (Contact c : Trigger.new)
    {        
        if (c.To_Be_Deleted__c == true)
        {                 
                   contactToBeDeleted.add(c);
        }
    }

  if(!contactToBeDeleted.isEmpty())
  {
   delete contactToBeDeleted;
  }

}

 

I am getting error

Reassign records based on territory, and that ability does not include custom objects just needs to be routed to one of the folks on my team based on the partners state which is a required field. Is it possible, I am trying to change the owner using trigger. Some how I am not able to do that, and is it possible any other way like  workflow.

VFP:

<apex:page standardController="Account" extensions="AccountPageblock" recordSetVar="records" id="thePage">
    <apex:form id="theForm">
        <apex:pageBlock id="thePageBlock">
            <apex:pageBlockTable value="{!records}" var="record" id="thePageBlockTable">
                <apex:column >
                    <apex:inputField value="{!record.Name}" id="AccountNameDOM" />
                   <apex:facet name="header">Name</apex:facet>
                </apex:column>
                <apex:column >
                    <apex:inputField value="{!record.Type}" id="AccountTypeDOM" />
                    <apex:facet name="header">Type</apex:facet>
                </apex:column>
                <apex:column >
                    <apex:inputField value="{!record.Industry}"
                        id="AccountIndustryDOM" />  
                        <apex:facet name="header">Industry</apex:facet>
                </apex:column>
                
            </apex:pageBlockTable>
            <apex:pageBlockButtons >
                <apex:commandButton value="Save" action="{!save}" id="saveButton" />
                <apex:commandButton value="Cancel" action="{!cancel}" id="cancelButton" />
            </apex:pageBlockButtons>
        </apex:pageBlock>
    </apex:form>
</apex:page>

 

Contoller:

public class AccountPageblock {

    public AccountPageblock(ApexPages.StandardSetController controller) {

    }
 
   public List<Account> getrecords() {
return [SELECT Type, Name, Industry FROM Account where Industry =: 'Energy'];
}
public abstract class MyController{
                Apexpages.StandardController controller;
                public MyController(Apexpages.StandardController c){
                controller = c;
                }
                public PageReference save() {
                controller.save();//invoke standard Save method
                return Apexpages.currentPage();//refresh current page
}
}

}

 

before we insert a new record in the customer object calculate the tax field value based on salary field value and then insert??

How i reach the right code ..??
This question may be very basic, but I am not a developer so my experience is very limited.  I created a custom button to populate a date field in my object.  Now I want to add to the code to prevent someone from using the button again.  Below is the code for the button.  What do I need to add to prevent the button from being used again?

- Thanks TS

{!REQUIRESCRIPT("/soap/ajax/20.0/connection.js")} 
 
var newRecords = [];
 
var c = new sforce.SObject("Custom_Quote_Request__c"); 
c.id ="{!Custom_Quote_Request__c.Id}";
c.Submit_Quote_Request_Date__c = new Date();
newRecords.push(c); 
 
result = sforce.connection.update(newRecords); 
 
window.location.reload();
Hi All,

I'm new to visualforce and trying satisfiy the Business on a new requirement that doesn't seem to be standard functionality in Salesforce.  I have a new object called Quality__c and I'm trying to show open Tasks within different sections of this object based on a custom field that is on the Task.  So for a record in the Quality__c Object there will be a section that is only going to show related Tasks that have an Activity_Type__c = 'Validation'

Here is my Visualforce page:
<apex:page standardController="Quality__c" extensions="SampleDetailPageCon">
    <apex:form >
        <apex:pageMessages />
        <apex:detail relatedList="true"></apex:detail>
        <apex:pageBlock id="customList" title="RelatedTasks">
            <apex:pageblocktable value="{!taskz}" var="o">
                <apex:column value="{!o.subject}"/>
                <apex:column value="{!o.ActivityDate}"/>
                <apex:column value="{!o.Status}"/>
                <apex:column value="{!o.Activity_Type__c}"/>
            </apex:pageblocktable>
        </apex:pageBlock>
        
    </apex:form>
</apex:page>

Here is my Apex controller:
public class SampleDetailPageCon {

    private List<Task> taskz;
    private Quality__c qual;
    
    public SampleDetailPageCon(ApexPages.StandardController controller) {
        
        this.qual = (Quality__c)controller.getRecord();
    }
    
    public List<Task> getTaskz() {
        
        taskz = [SELECT Id, Subject, ActivityDate, Activity_Type__c, Status from Task where Status = 'Open' and Activity_Type__c = 'Validation'];
        return taskz;
    }
}

When I run this visualforce page without any parameters in the URL it only brings back two Tasks that are open and have type of Validation.  Eventually I want to add in the ID as a parameter and only show that record's unique Validation Tasks but I'm not evern that far yet.

User-added image


The problem occurs when I try to embed this Visualforce page into the Quality__c object instead of just showing these two Tasks like before it shows an embedded copy of the entire Quality__c record in this new Section on the Quality__c page.

User-added image

I would like the "New Section" of this object to only show the Tasks that have an Activity_Type__c = "Validation" but instead it's showing the entire record again... Hopefully I'm just missing something small.

I really appreciate any help!
Jeff

public class AccountProfileFormExtention {
   
   public List<Visit_Report__c> visitReports,visitReportsAdd;
   public Visit_Report__c vReports,vReportsAdd; 
   set <id> acc1;   
   public Boolean nextdisplay=true;
   public Boolean savedisplay=true;
   public List<vAccounts> accountBussPlanList {get; set;}
   public List<vAccountsWO> accountBussPlanListWO {get; set;}
   List<Account> selectedAccounts = new List<Account>();
   List<Opportunity> selectedContacts = new List<Opportunity>();
  
   public Boolean getNextdisplay(){return nextdisplay;}
   public Boolean getSavedisplay(){return savedisplay;}
   
   public AccountProfileFormExtention(ApexPages.StandardController controller) {
         visitReports=getvisitReports();
     }
  /* public Visit_Report__c getvisitReportsAdd() {
      if(vReportsAdd == null)
         vReportsAdd = new Visit_Report__c();
      return vReportsAdd;
   }*/
   
   public PageReference getSelected(){
     
      for(vAccountsWO cCon1 : getnewAcctWO()) {
           selectedAccounts.clear();
           if(cCon1.selected == true) {
                 selectedAccounts.add(cCon1.acc);
            }
        }   
     return null;
    } 
      
    public Pagereference onLoad()
    {
      try{
            if(accountBussPlanList == null) {
       String currentQuater = ThisQuater();
             accountBussPlanList = new List<vAccounts>();
            
             List<Account> acc = new List<Account>();
             acc1 = new set <id>(); 
             
             Profile p= [Select Name, Id From Profile  where Name like 'Clinical Specialist'];
             if(UserInfo.getProfileId() == p.id){
                TerritoryManagement__c t = [Select Id From TerritoryManagement__c  where ClinicalSpecialistId__c=: UserInfo.getUserId() and IsActive__c= true Limit 1];
                acc = [SELECT id from Account where Target_Account__c = true and TerritoryManagementId__c =: t.Id];
             } 
             else {
                TerritoryManagement__c t = [Select Id From TerritoryManagement__c  where TerritoryManagerId__c=: UserInfo.getUserId() and IsActive__c= true Limit 1]; 
                acc = [SELECT id from Account where Target_Account__c = true and TerritoryManagementId__c =: t.Id];
             }  
             for(Integer i=0;i<acc.size();i++) {
              acc1.add(acc[i].Id);
             }
                        
            if(acc.size()>0){
                 for(Opportunity accBusPlan : [SELECT id,Sales_Account__c,Name from Opportunity where Sales_Account__c in: acc and Name like : currentQuater  ]) 
               {  accountBussPlanList.add(new vAccounts(accBusPlan));
               acc1.remove(accBusPlan.Sales_Account__c);
               }
              
             }   
             else {
               nextdisplay=false;
          savedisplay=true;
             }               
             
            }  
      }
      catch(Exception e)
      {
        ApexPages.addMessages(e);
        nextdisplay=false;
        savedisplay=false;
      }         
      return null;
    } 
      
    public List<vAccounts> getnewAcct(){
          return accountBussPlanList;
    }
    
    public List<vAccountsWO> getnewAcctWO(){
            if(acc1 != null) {
            accountBussPlanListWO = new List<vAccountsWO>();
          
             for(Account accBusPlan : [SELECT id,Name from Account where Id in: acc1 ]) {
                          accountBussPlanListWO.add(new vAccountsWO(accBusPlan));
             }                  
           }           
       return accountBussPlanListWO;
    }
    
    public PageReference processSelected() {
  
   for(vAccounts cCon : getnewAcct()) {
           if(cCon.selected == true) {
                selectedContacts.add(cCon.opp);
            }
        }
 
        for(vAccountsWO cCon1 : getnewAcctWO()) {
            
           if(cCon1.selected == true) {
                 selectedAccounts.add(cCon1.acc);
            }
        }     
        return  new PageReference('/apex/AccountPlanAdd');
    }
        
     public class vAccounts {
        public Opportunity opp {get; set;}
        public Boolean selected {get; set;}

        //This is the contructor method. When we create a new cContact object we pass a Contact that is set to the con property. We also set the selected value to false
        public vAccounts(Opportunity o) {
            opp = o;
            selected = true;
        }
    }
    
      public class vAccountsWO {
        public Account acc {get; set;}
        public Boolean selected {get; set;}

        //This is the contructor method. When we create a new cContact object we pass a Contact that is set to the con property. We also set the selected value to false
        public vAccountsWO(Account a) {
            acc = a;
            selected = true;
        }

 

 

VF Page:

 

<apex:page standardController="Visit_Report__c"
    extensions="AccountProfileFormExtention" action="{!onLoad}">
     <apex:pagemessages />
    <apex:form >
        <apex:pageBlock title="Accounts with Business Plans">

            <apex:pageBlockButtons >
                <apex:commandButton action="{!processSelected}" value="Next" rendered="{!nextdisplay}"/>
                <apex:commandButton action="{!saveAndAddVisitReports}" value="Create" rendered="{!savedisplay}"/>
            </apex:pageBlockButtons>
            
             <apex:pageBlockSection title="Accounts with Business Plans">
            <apex:pageBlockTable value="{!newAcct}" var="selectedAcc" rendered="{!(newAcct.size != 0)}">
                
                    <apex:column >
                        <apex:facet name="header">
                            <apex:inputCheckbox onclick="checkAll(this,'checkedone')" />
                        </apex:facet>
                        
                        <apex:inputCheckbox value="{!selectedAcc.selected}" id="checkedone">
                        </apex:inputCheckbox>
                    </apex:column>
                    
                    <apex:column >
                    <apex:facet name="header">Account</apex:facet>
                    <apex:outputField value="{!selectedAcc.opp.Sales_Account__c}" />
                </apex:column>

                <apex:column >
                    <apex:facet name="header">Account Business Plan Name</apex:facet>
                    <apex:outputField value="{!selectedAcc.opp.Name}" />
                </apex:column>
                  
            </apex:pageBlockTable>
             <apex:outputText rendered="{!(newAcct.size = 0)}" value="There are no reocrds to display." />
            </apex:pageBlockSection>  
            
              
            <apex:pageBlockSection title="Accounts with out Business Plans">
           <apex:pageBlockTable value="{!newAcctWO}" var="selectedAccWO" rendered="{!(newAcctWO.size != 0)}">
                                          
           <apex:column >
                        <apex:facet name="header">
                            
                        </apex:facet>
                       <apex:inputCheckbox value="{!selectedAccWO.selected}" id="checkeSec">
                       
                        </apex:inputCheckbox>
                    </apex:column> 
                   
                 <apex:column >
                 <apex:facet name="header">Account</apex:facet>
                 <apex:outputField value="{!selectedAccWO.acc.Name}" />
                 </apex:column>
             
           </apex:pageBlockTable> 
            <apex:outputText rendered="{!(newAcctWO.size = 0)}" value="There are no reocrds to display." />
            </apex:pageBlockSection>
            
           
            
         </apex:pageBlock>
        <script type="text/javascript">
    function checkAll(cb,cbid)
        {
            var inputElem = document.getElementsByTagName("input");                     
            for(var i=0; i<inputElem.length; i++)
            {             
                 if(inputElem[i].id.indexOf(cbid)!=-1){                                        
                    inputElem[i].checked = cb.checked;
                }
            }
        }
</script>
        

    </apex:form>

</apex:page>


Hi,

I am trying to integrate yourmembership.com with salesforce.

Here is the API link, https://api.yourmembership.com/

I need to get the info regarding all the non member into salesforce.

I was trying the callout after registering endpoint in SFDC.

Some how I am not able to do successfully. Any ideas or working examples how callout methods should be in salesforce.

 

Thanks

Nash

I am looking to customize standard Lead Convert page. I need to take out the option "DO Not create Opportunity on Lead Conertion". I am not able to find any solution other than going for custome lead convert page. Is there any other way to do.

Thanks

Nash 

 

trigger opptyCreationonConvert on Lead (after update) {     
    List<Opportunity> o= new List<Opportunity>();    

  for (Lead convertedLead : Trigger.new) {           

      if (convertedLead.IsConverted && convertedLead.ConvertedOpportunityId==null)            {         

              o.add (new Opportunity(                   

    Name = convertedLead.Company,                 

      CloseDate = date.today()+90,           

            AccountId = convertedLead.ConvertedAccountId,     

                  StageName = '1 - Qualification'));                        

          }     }  

  if (!o.isEmpty()) { 

       insert o;   

  }     }

trigger TobedeleteContact on Contact (after insert, after update) {
    
    List<Contact> contactToBeDeleted = new List<Contact>();
    Set<Id> ownerIds = new Set<Id>();
   for (Contact c : Trigger.new)
      ownerIds.add(c.OwnerId);
      for (Contact c : Trigger.new)
    {        
        if (c.To_Be_Deleted__c == true)
        {                 
                   contactToBeDeleted.add(c);
        }
    }

  if(!contactToBeDeleted.isEmpty())
  {
   delete contactToBeDeleted;
  }

}

 

I am getting error