• SalesforceLearner
  • NEWBIE
  • 30 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 17
    Questions
  • 7
    Replies
In the Notes and Attachment related list there is a button called Add Google Doc.
When clicked on that button it will take to a page to select google docs as shown below.

So my question is how to override Take me to google Docs link so that it will take to google drive instead of docs ?

Image
 I am using SFDC + VF tabs community template. I created a custom home page for communities.  I want to add Chatter link in that page so when ever user click on that page it should open chatter page for that partner user so that he can view chatter feed and post some messages on chatter.  Can anyone please tell me how to achieve this ?
I want to display cases related to loggedin user account. It is displaying empty list(it is not returning any values). When tried in query editor the query is working I am not understanding where i am making mistake can anyone pls help me with this ?
here is my code:
Controller:
public class CaseInformation{

        @AuraEnabled
        public static List<Case> getCases() {

        ID contactId = [Select contactid from User where id =: Userinfo.getUserid()].contactId;
        if(contactId == null)
        {
            return NULL;            
        }
        ID AccID  = [Select AccountID from Contact where id =: contactid ].AccountId;
            if(AccID == null){
                return NULL;
            }
            System.debug('AccountId :' + AccID + 'ContactId:' + contactId);
            List<Account> allAssocaiatedAccounts = [Select Id, name, industry from Account where Id =: AccID];
            if(allAssocaiatedAccounts.size() != 0){
            return [Select CaseNumber,Status,Priority,Type,Subject,AccountID from Case where AccountID IN: allAssocaiatedAccounts];
            }
            else {
                return NULL;
            }
    }  

}
Lightning Component:
 
<aura:component controller="CaseInformation">
<aura:attribute name="caseRows" type="Object[]"/>

    <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
<aura:iteration var="cas" items="{!v.caseRows.Cases}">
                    <tr class="border_bottom">
                        <td > {!cas.CaseNumber} </td>
                        <td > {!cas.Subject}  </td>
                        <td >{!cas.Status}</td>
                        <td> <ui:outputDate format="MMM dd yyyy" value="{!cas.CreatedDate}"/> </td>
                        <td >{!cas.Account.Name}</td>
                    </tr><hr class="hrcolclass" />
                </aura:iteration>
</aura:component>

Component Controller:
 
({
    doInit : function(component, event, helper){
        helper.getAllCases(component);
     }
})
Helper:
({
    getAllCases : function(component, event, helper) {
        var action = component.get("c.getCases");

        action.setCallback(this, function(a){
            component.set("v.caseRows", a.getReturnValue());
        });
        $A.enqueueAction(action);
    }
})



 

Hi,
I want to integrate Salesforce with Clarify tool, we are using clarify to store all the cases of accounts based on some account number.
if account number in salesforce is same as the account number related to case in clarify I want to pull the case data from clarify to salesforce. 
Could anyone please help me with this?
We are trying to use Mule soft for Anaplan integration with salesforce.
Could any one please explain the steps to follow to get data from anaplan and insert into the salesforce.
Below are the things which I want to acheive:  
1. Take data from anaplan
2. add data into the salesforce object in the form of records
I wrote a trigger on lead object where it Inserts opportunity record and update the Lookup field on Lead with Opportunity ID.

Here is my code it is inserting Opportuinity Record but it is not updating the field. And I want to use after Update only !! 
 
public class TriggerHelper {
 
    public static boolean isExecuting = false;
   
 
    public static void updateValues(){
  List<Opportunity> opp = new List<Opportunity>();
        if( TriggerHelper.isExecuting ){
            // if was executed durinListg the same context 
            // avoid recursion
            return;
        }
 
        TriggerHelper.isExecuting = true; 
        
        //list of new instance of object to update. 
        Lead[] lds = new Lead[]{};
      System.debug('@@@@@@@@@@@@@@@@@@@@@@@@@@@@');
        for (Lead a : (List<Lead>)Trigger.new) {  
        if(a.LastName == 'test'){
    
    Opportunity op = new Opportunity();
    op.Name = a.LastName;
    op.CloseDate= System.today()+20;
    op.StageName = 'Prospecting';
    opp.add(op);
    
    System.debug('$$$$$$$$$$$$$$$$$$$$$$$$$$$$$'+op);

            //here the magic by creating a new instance using the same id
            Lead aux  = new Lead(Id = a.Id);       
            aux.Opportunity__c =  opp[0].Id;
            
     
        System.debug('%%%%%%%%%%%%%%%%%%%%%%');
        } 
        
    }   
        //then update the new instance list. 
        Insert opp;
        Update lds;
 
    }
 
}


 
For Communities ceated a custom Loing Page when user enters username and password it will take to Landing Page.
My question is like how to access the login page in salesforce1
I created a VF page with input fields of Account Object. I created a select list on Vf page using controller. I want to update the input field(selected__c : datatype--text) with same value selected option in select list.

I tried below code but it is not working as i am making mistake somewhere.
Can anyone help me with this .
 
<apex:pageblocksection>

<apex:selectList value="{!selectedVal}" multiselect="false" readonly="true"  onchange="updateField()" size="1" id="ddlViewBy">
<apex:selectOptions id="selectid" value="{!contact}"/>
</apex:selectList>
<apex:inputfield id="customfield" value="{!Account.Match__c}"></apex:inputfield>
       
 </apex:pageblocksection>
<script>
 function updateField() {
 var e = document.getElementById("ddlViewBy");
 var strUser = e.options[e.selectedIndex].value;
 document.getElementById("customfield") = strUser;
  
 }

 </script>
Controller :
 
public List<SelectOption> getcontact() {   
    List<SelectOption> options = new List<SelectOption>();
     Account a = [Select id,Name,OwnerId,Match__C FROM Account where id =: this.account.id]; 
   con  = [Select id, Name from Contact  where OwnerId =: a.OwnerId];
    if (con.Size() >0)
 {     
    for(Contact c : con){
    if (c.Name != null)
      options.add(new SelectOption(c.Name,c.Name));
     }
   }
   return options;
}


 
Please help me on below one :
I created a custom edit page for Lead. I am displaying Opportunities on Lead based on some condition.
In the edit page i am displaying opportunities based on condition and check box to select. If a particular opportunity is choosen them it should display that opportunity name in text field.

So I am facing 2 issues
1. checkbox value is not saving in edit page it is showing as selected but after saving it is unchecked
2. How to update the field based on checkbox.

Opportunity On Lead edit  page

Here is my code :
 
<apex:pageBlockTable value="{!oppz}" var="o">

  <apex:column >
                    <apex:facet name="header" > Opportunity Name</apex:facet>
                    {!o.name}
                        </apex:column>

                        <apex:column headerValue="Select">

                        <input type="checkbox" id="looped" onclick="enableDisable(this)" /></apex:column>      

</apex:pageBlockTable>

Controller :
 
public class LeadandOpportunities {

    public List<Opportunity> oppz;
    public boolean IsChecked {get; set;}

    //public Opportunity op;
    public Lead lead; 
    public LeadandOpportunities (ApexPages.StandardController controller) {
        system.debug('##########################');

        this.lead= (Lead)controller.getRecord();
        IsChecked = false;
    }
    public List<Opportunity> getOppz()
    {
        Lead l = [Select id,Name,OwnerId FROM Lead where id =: this.lead.id];
        system.debug('@@@@@@@@@@' +l);

        if (l.OwnerId== null)
            return null;
        oppz = [Select id, Name, Account.Name,Select__c, CloseDate, Amount, Type from Opportunity where OwnerId =: l.OwnerId];
        System.debug('$$$$$$$' + oppz);
        return oppz;
    }
}


 
I want to add opportunity names in inline VF page on Lead page layout if the lead owner is same as opportunity owner and he should select one opportunity in the VF page and when he click save button the opportunity name also should get saved.

Is it possible ?
If lead owner is same as Opportunity Owner then I want to display opportunity names in multiselect picklist field on pagelayout.

Is it possible with trigger ?
I have end point url

http://proxy.abc.com/aproxy/rssFeed.jsp?rssUrl=http://news.abc.com/rss.jkl%3Fsection_id%4F5

when opened it is in the form of XML as shown below which displays news information.
<title>
<![CDATA[
ABCDEFGH
]]>
</title>
<link>
https://news.com
</link>
<description>
<![CDATA[ ]]>
</description>

I wrote below code to display on VF page but it is giving "Attempt to de-reference a null object" Error. When I debugged it is throwing error at RSS classDom.XMLNode rss = doc.getRootElement(); I dont no where I am making mistake.

Page :
<apex:page controller="RSSNewsReader" sidebar="false" showHeader="false" cache="false">


<apex:pageBlock id="rssBlock" tabStyle="Lead">


    <apex:pageBlockSection title="Channel" columns="2">
        <apex:pageBlockSectionItem >
            <apex:outputLabel value="title" />
            <apex:outputText value="{!RSSFeed.title}" />
        </apex:pageBlockSectionItem>
        <apex:pageBlockSectionItem >
            <apex:outputLabel value="link" />
            <apex:outputText value="{!RSSFeed.link}" />
        </apex:pageBlockSectionItem>
        <apex:pageBlockSectionItem >
            <apex:outputLabel value="description" />
            <apex:outputText value="{!RSSFeed.description}" />
        </apex:pageBlockSectionItem>
        <apex:pageBlockSectionItem >
            <apex:outputLabel value="category" />
            <apex:outputText value="{!RSSFeed.category}" />
        </apex:pageBlockSectionItem>
       </apex:pageBlockSection>


</apex:pageBlock>

</apex:page>

Controller :
public class RSSNewsReader {

    public String rssQuery {get;set;}
    private String rssURL {get;set;}

    public RSSNewsReader() {

        rssURL = 'http://news.abc.com/rss.jkl%3Fsection_id%4F5';
        rssQuery = ''; //default on load

    }

    public RSS.channel getRSSFeed() {
        return RSS.getRSSData(rssURL);
    }


}
class:
 
public class channel {
        public String title {get;set;}
        public String link {get;set;}
        public String description {get;set;}
        public String author {get;set;}
        public String category {get;set;}
        public String copyright {get;set;}
        public String docs {get;set;}
        public RSS.image image {get;set;}
        public list<RSS.item> items {get;set;}
        public channel() {
            items = new list<RSS.item>();
        }
    }

    public class image {
        public String url {get;set;}
        public String title {get;set;}
        public String link {get;set;}
    }

    public class item {
        public String title {get;set;}
        public String guid {get;set;}
        public String link {get;set;}
        public String description {get;set;}
        public String pubDate {get;set;}
        public String source {get;set;}
        public Date getPublishedDate() {
            Date result = (pubDate != null) ? Date.valueOf(pubDate.replace('T', ' ').replace('Z','')) : null;
            return result;
        }
        public DateTime getPublishedDateTime() {
            DateTime result = (pubDate != null) ? DateTime.valueOf(pubDate.replace('T', ' ').replace('Z','')) : null;
            return result;
        }
    }

    public static RSS.channel getRSSData(String FeedURL) {

        HttpRequest req = new HttpRequest();
        req.setEndpoint(FeedURL);
        req.setMethod('GET');

        Dom.Document doc = new Dom.Document();
        Http h = new Http();


        Dom.XMLNode rss = doc.getRootElement();
        //first child element of rss feed is always channel
        Dom.XMLNode channel = rss.getChildElements()[0];

        RSS.channel result = new RSS.channel();

        list<RSS.item> rssItems = new list<RSS.item>();

        //for each node inside channel
        for(Dom.XMLNode elements : channel.getChildElements()) {
            if('title' == elements.getName()) {
                result.title = elements.getText();
            }
            if('link' == elements.getName()) {
                result.link = elements.getText();
            }
            if('description' == elements.getName()) {
                result.description = elements.getText();
            }
            if('category' == elements.getName()) {
                result.category = elements.getText();
            }
            if('copyright' == elements.getName()) {
                result.copyright = elements.getText();
            }
            if('docs' == elements.getName()) {
                result.docs = elements.getText();
            }
            if('image' == elements.getName()) {
                RSS.image img = new RSS.image();
                //for each node inside image
                for(Dom.XMLNode xmlImage : elements.getChildElements()) {
                    if('url' == xmlImage.getName()) {
                        img.url = xmlImage.getText();
                    }
                    if('title' == xmlImage.getName()) {
                        img.title = xmlImage.getText();
                    }
                    if('link' == xmlImage.getName()) {
                        img.link = xmlImage.getText();
                    }
                }
                result.image = img;
            }

            if('item' == elements.getName()) {
                RSS.item rssItem = new RSS.item();
                //for each node inside item
                for(Dom.XMLNode xmlItem : elements.getChildElements()) {
                    if('title' == xmlItem.getName()) {
                        rssItem.title = xmlItem.getText();
                    }
                    if('guid' == xmlItem.getName()) {
                        rssItem.guid = xmlItem.getText();
                    }
                    if('link' == xmlItem.getName()) {
                        rssItem.link = xmlItem.getText();
                    }
                    if('description' == xmlItem.getName()) {
                        rssItem.description = xmlItem.getText();
                    }
                    if('pubDate' == xmlItem.getName()) {
                        rssItem.pubDate = xmlItem.getText();
                    }
                    if('source' == xmlItem.getName()) {
                        rssItem.source = xmlItem.getText();
                    }
                }
                //for each item, add to rssItem list
                rssItems.add(rssItem);
            }

        }
        //finish RSS.channel object by adding the list of all rss items
        result.items = rssItems;

        return result;

    }



}


 
I have end point url(when opened it is in the form of XML as shown below which displays news information).
 
<title> <![CDATA[ ABCDEFGH ]]> </title>
 <link> https://news.com </link>
 <description> <![CDATA[ ]]> </description>
So my question is how to call that url and display news information on VF page.

As i am new to salesforce I am not understanding how to do that.
How to display the currently logged in partner user accounts on Lightning component ?

I am using below code but it is not working 

public class AccountInformation {
   @AuraEnabled
   public static List<Account> getAcc() {
       
        ID contactId = [Select contactid from User where id =: Userinfo.getUserid()].contactId;

        ID AccID  = [Select AccountID from Contact where id =: contactid ].AccountId;
      
      return [SELECT Id, name, Industry FROM Account where Id =: AccID ];
   }   
}
My Controller :
public class AccountOpportunity {

    public String userid{get;set;}


    public AccountOpportunity (){
    userid = Userinfo.getUserId();

        fetchData();
    }
   
    public void fetchData(){
  
       List<Opportunity> op = [Select name,Id,AccountId,Amount from Opportunity ];
        //Parent Id set
        Set<id> parentIdSet = new Set<id>();
        //Create parent Id set 
        for(Opportunity OppRec :op){
            parentIdSet.add(OppRec.AccountId);
        }
        
        //Fetch all associated parents
        
        
        List<Account> allAssocaiatedAccounts = [Select name,id,AnnualRevenue,Industry from Account where Id IN : parentIdSet ];
        
        wrapperList = new list<myWrapperClass>();
        //For loop to set data
        for(Opportunity childRec : allOpps){
            //myWrapperClass wrapRec;
            for(Account parentRec :allAssocaiatedAccounts){
                if(parentRec.Id == childRec.AccountId){
                    myWrapperClass wrapRec = new myWrapperClass();
                    wrapRec.acc = parentRec;
                    wrapRec.opp = childRec;
                    wrapperList.add(wrapRec);
                }
            }
             
            //Adding Opportunities without account
            if(childRec.AccountId == null){
                    myWrapperClass wrapRec = new myWrapperClass();
                    //wrapRec.acc = null;
                    wrapRec.opp = childRec;
                    wrapperList.add(wrapRec);
            }
         
        } 
    }
   
 

public List<myWrapperClass> wrapperList {get; set;}

public class myWrapperClass{
    public Account acc{get;set;}
    public Opportunity opp{get;set;}
    public Boolean selected {get; set;} 
    public myWrapperClass() { 
         selected = false; 
      } 
}
}
I am able to display All accounts with opportunities but I want to display it based on the login User.
Does anyone know how to display currently login user Accounts & its opportunities?
I tried using below code but it is not working. If i use it in Vf page it is working.

Page


<apex:pageBlockSection columns="1" rendered="{!NOT(isString=true)}"> <apex:pageBlockSectionItem labelStyle="text-align: left; padding-bottom: 15px"> <apex:outputLabel value="{!$Label.Revenue}" for="tabIndex21" /> </apex:pageBlockSectionItem> <apex:pageBlockSectionItem labelStyle="text-align: left; padding-bottom: 15px"> <apex:inputField id="tabIndex21" value="{!MPE.Revenue__C}" required="true"/> </apex:pageBlockSectionItem>
<apex:pageBlockSection >

Apex:

public void emeaChanges()
 {
          isString = false;
          
          if(EmpwrApp.Region_Theater__c.Contains('WEST'))
          {
          if((EmpwrApp.Technology_Segment_Interest__c.Contains('X'))||(EmpwrApp.Technology_Segment_Interest__c.Contains('Y'))||(EmpwrApp.Technology_Segment_Interest__c.Contains('Z')))
          {
                isString = true;
          
          }
         
          }
          else
          {
          isString = false;
          }
For Communities ceated a custom Loing Page when user enters username and password it will take to Landing Page.
My question is like how to access the login page in salesforce1
getting this error when trying to run a lighning app . If I remove the extends="ltng:outApp" , the error goes away. Any suggestions ?
-lightning is enabled in the org.
-extends ltng:outApp is required to include this in a VF page. 

<aura:application access="GLOBAL" extends="ltng:outApp">
    <!-- Define the Design System static resource (version 0.9.0) -->
    <c:scoryAppCard />
</aura:application>

any suggestions?
 
I have end point url

http://proxy.abc.com/aproxy/rssFeed.jsp?rssUrl=http://news.abc.com/rss.jkl%3Fsection_id%4F5

when opened it is in the form of XML as shown below which displays news information.
<title>
<![CDATA[
ABCDEFGH
]]>
</title>
<link>
https://news.com
</link>
<description>
<![CDATA[ ]]>
</description>

I wrote below code to display on VF page but it is giving "Attempt to de-reference a null object" Error. When I debugged it is throwing error at RSS classDom.XMLNode rss = doc.getRootElement(); I dont no where I am making mistake.

Page :
<apex:page controller="RSSNewsReader" sidebar="false" showHeader="false" cache="false">


<apex:pageBlock id="rssBlock" tabStyle="Lead">


    <apex:pageBlockSection title="Channel" columns="2">
        <apex:pageBlockSectionItem >
            <apex:outputLabel value="title" />
            <apex:outputText value="{!RSSFeed.title}" />
        </apex:pageBlockSectionItem>
        <apex:pageBlockSectionItem >
            <apex:outputLabel value="link" />
            <apex:outputText value="{!RSSFeed.link}" />
        </apex:pageBlockSectionItem>
        <apex:pageBlockSectionItem >
            <apex:outputLabel value="description" />
            <apex:outputText value="{!RSSFeed.description}" />
        </apex:pageBlockSectionItem>
        <apex:pageBlockSectionItem >
            <apex:outputLabel value="category" />
            <apex:outputText value="{!RSSFeed.category}" />
        </apex:pageBlockSectionItem>
       </apex:pageBlockSection>


</apex:pageBlock>

</apex:page>

Controller :
public class RSSNewsReader {

    public String rssQuery {get;set;}
    private String rssURL {get;set;}

    public RSSNewsReader() {

        rssURL = 'http://news.abc.com/rss.jkl%3Fsection_id%4F5';
        rssQuery = ''; //default on load

    }

    public RSS.channel getRSSFeed() {
        return RSS.getRSSData(rssURL);
    }


}
class:
 
public class channel {
        public String title {get;set;}
        public String link {get;set;}
        public String description {get;set;}
        public String author {get;set;}
        public String category {get;set;}
        public String copyright {get;set;}
        public String docs {get;set;}
        public RSS.image image {get;set;}
        public list<RSS.item> items {get;set;}
        public channel() {
            items = new list<RSS.item>();
        }
    }

    public class image {
        public String url {get;set;}
        public String title {get;set;}
        public String link {get;set;}
    }

    public class item {
        public String title {get;set;}
        public String guid {get;set;}
        public String link {get;set;}
        public String description {get;set;}
        public String pubDate {get;set;}
        public String source {get;set;}
        public Date getPublishedDate() {
            Date result = (pubDate != null) ? Date.valueOf(pubDate.replace('T', ' ').replace('Z','')) : null;
            return result;
        }
        public DateTime getPublishedDateTime() {
            DateTime result = (pubDate != null) ? DateTime.valueOf(pubDate.replace('T', ' ').replace('Z','')) : null;
            return result;
        }
    }

    public static RSS.channel getRSSData(String FeedURL) {

        HttpRequest req = new HttpRequest();
        req.setEndpoint(FeedURL);
        req.setMethod('GET');

        Dom.Document doc = new Dom.Document();
        Http h = new Http();


        Dom.XMLNode rss = doc.getRootElement();
        //first child element of rss feed is always channel
        Dom.XMLNode channel = rss.getChildElements()[0];

        RSS.channel result = new RSS.channel();

        list<RSS.item> rssItems = new list<RSS.item>();

        //for each node inside channel
        for(Dom.XMLNode elements : channel.getChildElements()) {
            if('title' == elements.getName()) {
                result.title = elements.getText();
            }
            if('link' == elements.getName()) {
                result.link = elements.getText();
            }
            if('description' == elements.getName()) {
                result.description = elements.getText();
            }
            if('category' == elements.getName()) {
                result.category = elements.getText();
            }
            if('copyright' == elements.getName()) {
                result.copyright = elements.getText();
            }
            if('docs' == elements.getName()) {
                result.docs = elements.getText();
            }
            if('image' == elements.getName()) {
                RSS.image img = new RSS.image();
                //for each node inside image
                for(Dom.XMLNode xmlImage : elements.getChildElements()) {
                    if('url' == xmlImage.getName()) {
                        img.url = xmlImage.getText();
                    }
                    if('title' == xmlImage.getName()) {
                        img.title = xmlImage.getText();
                    }
                    if('link' == xmlImage.getName()) {
                        img.link = xmlImage.getText();
                    }
                }
                result.image = img;
            }

            if('item' == elements.getName()) {
                RSS.item rssItem = new RSS.item();
                //for each node inside item
                for(Dom.XMLNode xmlItem : elements.getChildElements()) {
                    if('title' == xmlItem.getName()) {
                        rssItem.title = xmlItem.getText();
                    }
                    if('guid' == xmlItem.getName()) {
                        rssItem.guid = xmlItem.getText();
                    }
                    if('link' == xmlItem.getName()) {
                        rssItem.link = xmlItem.getText();
                    }
                    if('description' == xmlItem.getName()) {
                        rssItem.description = xmlItem.getText();
                    }
                    if('pubDate' == xmlItem.getName()) {
                        rssItem.pubDate = xmlItem.getText();
                    }
                    if('source' == xmlItem.getName()) {
                        rssItem.source = xmlItem.getText();
                    }
                }
                //for each item, add to rssItem list
                rssItems.add(rssItem);
            }

        }
        //finish RSS.channel object by adding the list of all rss items
        result.items = rssItems;

        return result;

    }



}


 
I am able to display All accounts with opportunities but I want to display it based on the login User.
Does anyone know how to display currently login user Accounts & its opportunities?