• alsinan nazim
  • NEWBIE
  • 143 Points
  • Member since 2016
  • Salesforce Developer
  • Suyati Technologies


  • Chatter
    Feed
  • 4
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 8
    Questions
  • 33
    Replies
I am looking to set a variable depending on the value of a field.

EmailTemplate template = 
    if(a__c == 'a' || a__c == 'b'){
    [SELECT Id, Subject, HtmlValue, Body FROM EmailTemplate WHERE Name = 'ab_Email']}
    else {
    [SELECT Id, Subject, HtmlValue, Body FROM EmailTemplate WHERE Name = 'c_Email']};

Please can someone show me the correct way to do this?

Thank you
Joe
Can anyone tell me, how i find my custom navigation menu in Lightning Experience of Winter 17.?
In a Lightning Component, I define an input with onchange or onblur - e.g.

    <lightning:input name="timeHours" label="Hours" onblur="{!c.onTimeBlur}" />

in my controller there is:

    onTimeBlur : function(component, event, helper) {
    },

The result is:
    Something has gone wrong. Underlying raw object [object Object] does not support property: currentTarget
    Failing descriptor: {accorto$Time$controller$onTimeBlur}.
    Please try again.
So it finds the javascript method but then fails.

Works fine for the <ui:input blur="{!c.onTimeBlur}" ..../>
Hi,
I have one problem in aura:renderIf condition in iteration component.
I have one requirement in which i have two aura:iteration loops like following

<aura:iteration items={!v.cntlst} var='val'>
         <aura:iteration items={!v.stalst} var='n'>
                 <aura:renderIf isTrue='{! val == n.flval}'>
                             //components to show
                 </aura:renderIf>
         </aura:iteration>
</aura:iteration>

But it is not showing anything even it matches the condition. I think the isTrue condition is not written proper.
Please help me to correct this condition.
Thanks in advance.

Hi All,
We have an Apex webservice created for external applications to create/access Salesforce data. We are using OAuth based authentication with the help of a connected app. In a recent security assessment, the team pointed out that the request does not contain an anti-CSRF token. They have raised this a high level finding. I assume that CSRF is only required when we develop applications with Visualforce/Forms. and in this case we only has the server side Apex logic implemented. In the response, they are getting CSRF token as null, when we try the request using postman.

Any thoughts and help would be much appreciated.

Hello Everyone

I got an issue when firing the below event from Helper, and is working fine in controller in Lightning Component. Any hints?
var createRecordEvent = $A.get("e.force:createRecord");
createRecordEvent.setParams({
            "entityApiName": "Account" // using account standard object for this sample
        });
 createRecordEvent.fire();

 
Hi,

I want to display SF dashboards in a custom Lightning component. Is there a way to get the dashboard directly or can we get the report data in lightning component and then build a dashboard using the same.?
Any help?
Hi all,

I had created some pushtopics for some sObjects. How can I enable the same to get notifications for all the Logged in sessions, for the same Pushtopic created, If am using more than one instanse of the same org. (Session id will be diff...right?)..?
Hi all,
I know we can access Custom Labels in Apex and VF.
But, Can we Update the value of a Custom Label through Apex Controller?


If So, How?

With Thanks.
Hi, 

I had created a community using a VF page which is integrated with Lightning Component using lightning out. The Problem is, an external user cant access the page (not able to view the data on the page) without Login as a customer community login user. So I need to create an auto login functionality, ie, Automatically login as a guest when a user is directed to the community URL. How can I achieve that so that the external user can login without he knows, when the community home page (The same VF Page) is loaded first and then he can signup or login as himself. At first I'm thinking of providing a community login user username and password through an apex class. 

Any help will be appreciated..
Thank You.
Hi,

I have a lightning app with a single component. I just integreted it into a VF page using Lightning Out dependency so that I can set that page as a community home page. But the div that has to create the component is not displaying in a guest user mode, and if we login as a community login user we are able to see the same. Other text and images in the VF page body is showing even without login.

My VF Page is shown below:

<apex:page applyBodyTag="false" applyHtmlTag="false" standardStylesheets="false" showHeader="false" sidebar="false" >
    <apex:includeLightning />
    <apex:includeScript value="/lightning/lightning.out.js"/>
<script>
    //Tell your Visualforce page to use NewMenuApp Lightning app
    $Lightning.use("c:TestCartApp", function() {
        // Write a function that creates the component on the page
        $Lightning.createComponent("c:TestCart",
                                   {},
                                   "myLightningApp",
                                   function(cmp) {      
                                   });
    });
    </script>
    <body>
        <div id="myLightningApp" />
    </body>   
</apex:page>

I need that div to be displayed to all users with the community URL without login.
Is there any other way we can display the same component in the page without user authentication, or any fix, workaround to acheive the same. Thank You.
Hi,

I need to create a community using a lightning application composed of a single component. The said app is like a website with a header and nav menubar. When creating the community, Im asked to select a template (eg: NAPILI) and becouse of the template my apps design got overlapped with community header. But i need to login to the app using community user accounts. Is there any way I can do this with or without community builder so that I can get the community user profile header component in my app??

Thank you in advance. 

Hi All,
We have an Apex webservice created for external applications to create/access Salesforce data. We are using OAuth based authentication with the help of a connected app. In a recent security assessment, the team pointed out that the request does not contain an anti-CSRF token. They have raised this a high level finding. I assume that CSRF is only required when we develop applications with Visualforce/Forms. and in this case we only has the server side Apex logic implemented. In the response, they are getting CSRF token as null, when we try the request using postman.

Any thoughts and help would be much appreciated.

Hi All,

how to refresh a individual component after clicking on save button?
that effects to see update information in the component

Thanks ,
Ram.
I am looking to set a variable depending on the value of a field.

EmailTemplate template = 
    if(a__c == 'a' || a__c == 'b'){
    [SELECT Id, Subject, HtmlValue, Body FROM EmailTemplate WHERE Name = 'ab_Email']}
    else {
    [SELECT Id, Subject, HtmlValue, Body FROM EmailTemplate WHERE Name = 'c_Email']};

Please can someone show me the correct way to do this?

Thank you
Joe
User-added image i need to create to page like this and i need to insert into a tab .can any one give a idea how to go through this
Hello,

we wrote rest API class for forgot password(from iOS application to salesforce). The code sent to testing team for Vulnerability test.
iOS sent forgot request to sfdc--> salesforce validate valid user --> sent random number to another server--> reset the password
They replied result as "CSRF protection" issue.
I have checked session settings in my developer org. It has default enabled checkboxes(Cross-Site Request Forgery (CSRF) Protection)
security controls--->session settings
Enable CSRF protection on GET requests on non-setup pages
Enable CSRF protection on POST requests on non-setup pages

please find below API code

@RestResource(urlMapping='/Forgotpassword/*')   global with sharing class Forgotpassword{  //@future(callout=true) @httppost global static void forgetPWD(String email){ List<User_details__c> userDetails = [select id,First_name__c,Middle_name__c,Last_name__c,password__c, Email__c from User_details__c where Email__c =:email];   string mail; string names; string password; Integer len=10; final String chars='012345adfc'; String randStr=''; while(randStr.length()<len) { Integer idx=Math.mod(Math.abs(Crypto.getRandomInteger()),chars.length()); randStr +=chars.substring(idx, idx+1); } //return randStr;  if(userDetails.size()>0){            for(User_details__c user:userDetails)       {       mail=user.Email__c;       names=user.First_name__c;       password=randStr;       }       //sendresponse=mail;       Status__c st =new Status__c();                st.message__c = 'User is available';                st.code__c = 0;                st.userId__c = userDetails[0].id ;                system.debug('st'+st);                  insert st;                //return st;                 }                else                {                Status__c st =new Status__c();                st.message__c = 'User not available';                st.code__c = 0;                st.userId__c =null;                system.debug('st'+st);                  insert st;                //return st;                  }                 system.debug('email '+mail);                 system.debug('name '+names);                 system.debug('message '+password);                 callback1(mail,names,password);                                        }       @future(callout=true)   global static void callback1(String mail,String names,String password){    httprequest req=new httprequest();                 JSONGenerator gen = JSON.createGenerator(true);                 gen.writeStartObject();                 gen.writestringField('email', mail);                 gen.writestringField('name', names);                 gen.writestringField('message', password);                gen.writeEndObject();            String postjson=gen.getAsString();            system.debug('Gen'+postjson);                req.setendpoint('http://52.72.252.80:8080/ResetPassword/Forgotpassword');            req.setHeader('Content-Type','application/json');              req.setBody(postjson);              req.setmethod('POST');             system.debug('req  '+req);                 http ht=new http();            httpresponse res=ht.send(req);            system.debug('res'+res);} }

Kindly let us know how to resolve CSRF issue.
Any help will be appreciated.

Regards
Tirumala K
Hi,

I want to display SF dashboards in a custom Lightning component. Is there a way to get the dashboard directly or can we get the report data in lightning component and then build a dashboard using the same.?
Any help?
I tried this code for a simple redirection from custom page to record page, but it seems I kept getting cross domain error.
Anybody encounter this?  If yes, is there any known workaround beside using Apex Class?
<apex:page showHeader="false" sidebar="false">
	<script type="text/javascript">
   		window.onload = init;
    
    	function init(){
    		var button = document.getElementById('testButton');
    		button.addEventListener('click',redirectFunct);
    	}
    	function redirectFunct(){
            window.location.href = '/' + '{!$CurrentPage.parameters.id}';
            return false;
        }
	</script>

    <input type="button" value="hello world 2!" onclick="redirectFunct()"/>
	<button id="testButton">
        hello world
    </button>
</apex:page>

 

i am working on Salesforce Lighning.when i create a new account it shows notification in salesforce 1.how can i do it.i already enabled push notification option in lightning.Can any one try to help me.

Thanks..

Can any one tell What are the notable features in salesforce Lightning and what is the use of it and how it differ from salesforce classic.
I am working on lightning project.
I wanted to create a menu which contains parent node and child node .on click of child node a corresponding component will be called.
<c:objectPanel />

the details of this menu and corresponding componemt are stored in custom object (Menudetails).
How is it possible in Salesforce lightning.If not how to achieve this left menu as shown in below link.
https://developer.salesforce.com/docs/atlas.en-us.fundamentals.meta/fundamentals/adg_app_arch.htm


.Inserting Parent and child objects simultanously.
secondly i wanted to create a component which will insert parent and corresponding child record.
insert child record section will open on clicking on checkbox(Has child).
I want to  import productlist that is in excel format into the picklist values for the order management. how can I achieve this. Thanks in Advance
Hii.
Using apex:repeat tag i have created table to display two radio buttons and a text field which is dependent on the selection of one of these radio buttons.Using Command link i am adding new row. Only the last row text field is responding for radio button selection but not for the previous rows.I want each row text field to respond to its corresponding radio button. Thank you.....
how can i create records from scratch????? 
how can i create user records????
Can anyone tell me, how i find my custom navigation menu in Lightning Experience of Winter 17.?
please look at this pic
<apex:page controller="Pagination_min"  showHeader="false" sidebar="false"  extensions="AccountController">
  <apex:form >
    <apex:pageBlock >
        <apex:pageBlockSection columns="1"  title="Accounts"> 
            <apex:pageBlockTable value="{!accounts}" var="a">
                <apex:column >
                   <apex:outputLink title="" value="/{!a.id}/e?retURL=/apex/{!$CurrentPage.Name}" style="font-weight:bold">Edit</apex:outputLink>&nbsp;|&nbsp;

                </apex:column>
                <apex:column value="{!a.Name}"/>
                <apex:column value="{!a.Type}"/>
                <apex:column value="{!a.BillingCity}"/>
                <apex:column value="{!a.BillingState}"/>
                <apex:column value="{!a.BillingCountry}"/>
            </apex:pageBlockTable>
            <apex:panelGrid columns="7">
            <apex:commandButton value="|<" action="{!setcon.first}" disabled="{!!setcon.hasPrevious}" title="First page"/>
            <apex:commandButton value="<" action="{!setcon.previous}" disabled="{!!setcon.hasPrevious}" title="Previous page"/>
            <apex:commandButton value=">" action="{!setcon.next}" disabled="{!!setcon.hasNext}" title="Next page"/>
            <apex:commandButton value=">|" action="{!setcon.last}" disabled="{!!setcon.hasNext}" title="Last page"/>
           
             <apex:outputText >{!(setCon.pageNumber * size)+1-size}   -    {!IF((setCon.pageNumber * size)>noOfRecords, noOfRecords,(setCon.pageNumber * size))} of {!noOfRecords}</apex:outputText>
                <apex:commandButton value="Refresh" action="{!refresh}" title="Refresh Page"/>
            </apex:panelGrid>
        </apex:pageBlockSection>
     </apex:pageBlock>
                      <apex:pageBlock title="My Content" mode="edit">
                          <apex:pageBlockButtons >
                               <apex:commandButton action="{!save}" value="Save" reRender="pb"/>
                          </apex:pageBlockButtons>
                               <apex:pageBlockSection title="My Content Section" columns="2">
                                    <apex:inputField value="{!account.name}" required="false"/>
                                    <apex:inputField value="{!account.type}"/>
                                    <apex:inputField value="{!account.Billingcity}"/>
                                    <apex:inputField value="{!account.billingstate}"/>
                                    <apex:inputField value="{!account.billingcountry}"/>
                               </apex:pageBlockSection>
                      </apex:pageBlock>
  </apex:form>               
</apex:page>
**************************************************************************************
public class Pagination_min {

    Public Integer noofRecords {get; set;}
    public integer size {get; set;}
   
    public Apexpages.standardsetController setcon{
        get{
            if(setCon == null){
                size = 10;
                String queryString = 'Select Name, Type, BillingCity, BillingState, BillingCountry from Account order by Name';
                setcon = new apexpages.standardsetController(Database.getquerylocator(queryString));
                setcon.setpagesize(size);
                noofRecords = setcon.getResultsize();
            }
            return setcon;
        }
         set;
    }
    Public list<Account> getAccounts(){
        list<Account> acclist = new list<Account>();
         for(Account ac : (list<Account>)setcon.getrecords()){
             acclist.add(ac);
         }
        return accList;
       
      
    }
   Public PageReference Refresh(){
       
        setcon=null;
        getAccounts();
        setcon.setpageNumber(1);
       
        return null;
    }
}
**********************************************************************
public with sharing class AccountController {
   
    public Account account{get; set;}
    public AccountController(Pagination_min controller) {
      account = new Account();
    }
    
    public void save(){
        upsert account;
    }
}
In a Lightning Component, I define an input with onchange or onblur - e.g.

    <lightning:input name="timeHours" label="Hours" onblur="{!c.onTimeBlur}" />

in my controller there is:

    onTimeBlur : function(component, event, helper) {
    },

The result is:
    Something has gone wrong. Underlying raw object [object Object] does not support property: currentTarget
    Failing descriptor: {accorto$Time$controller$onTimeBlur}.
    Please try again.
So it finds the javascript method but then fails.

Works fine for the <ui:input blur="{!c.onTimeBlur}" ..../>
Can someone please explain (and possibly fix) why the last section on my VF Page falls out of the frame?  The other frames stay within the "page" but the last section falls off.  

User-added image
 
<apex:page standardController="License_Numbers__c" recordSetvar="lic" extensions="LicenseList" showHeader="false" sidebar="false">
<!------------------------------------------------------------------------------------------------------>
<!--Based on option chosen for License Type, will show description of that license type-->
<apex:pageBlock title="License Definitions">
<apex:form id="theForm">
<apex:pageBlockSection columns="1">
<apex:selectList label="Please select a License Type"  value="{!discountScheduleID}" size="1" >
   <apex:actionSupport event="onchange" action="{!displayDescription}" rerender="description"/>
   <apex:selectOptions value="{!schedules}" />
</apex:selectList> 

<apex:outputText label="Description" id="description" value="{!OutPutString}"/>

<br></br><br></br><br></br><br></br>
</apex:pageBlockSection>
</apex:form>
</apex:pageBlock>
<!---------------------------------------------------------------------------------------------------->
<apex:form >
<!--displays the licenses that are owned by your business unit (declared on User record)-->
<apex:pageBlock title="Current Licenses">
<apex:pageBlockSection columns="1">

<apex:pageBlockTable value="{!LicenseList}" var="ln">

<apex:outputLink value="{!ln.Id}">{!ln.Name}</apex:outputLink>

<apex:column value="{!ln.Org__c}" />
<apex:column value="{!ln.Business_Unit__c}" />
<apex:column value="{!ln.BMS_Code__c}" />
<apex:column value="{!ln.License_Type__c}" />
<apex:column value="{!ln.Monthly_Unit_Price__c}" />
<apex:column headerValue="2016 Starting Amount" value="{!ln.X2016_Starting_Amount__c}" />
<apex:column headerValue="2016 Running License Total" value="{!ln.Running_License_Total__c}" />
<apex:column headerValue="2016 Annualized Cost" value="{!ln.X2016_Subtotal__c}" />
<apex:column headerValue="2016 Cost" value="{!ln.X2016_Cost__c}"/>

</apex:pageBlockTable>
</apex:pageBlockSection>

                
          
</apex:pageBlock>

</apex:form>

<apex:panelGrid columns="1">

</apex:panelGrid>



<!--------------------------------------------------------------------------------------------------------->
<apex:form id="theForm">
<apex:pageBlock id="blockId" title="2017 License Needs">
<apex:pageBlockSection columns="1">

<td>
<apex:outputText style="font-weight:800" label="Total 2017 Annualized Cost" value="${0, number, ###,###,###,##0.00}">
    <apex:param value="{!tTotal}" />
</apex:outputText>
</td>
<td>
<apex:outputText style="font-weight:800" label="Total 2017 Estimated Cost" value="${0, number, ###,###,###,##0.00}">
    <apex:param value="{!aTotal}" />
</apex:outputText>
</td>
</apex:pageBlockSection>

<!-------------------------------------------------------------------------------------------------->


<apex:pageBlockTable value="{!LicenseList17}" var="ln17">

<apex:outputLink value="{!ln17.Id}">{!ln17.Name}</apex:outputLink>
<apex:column >
<apex:commandbutton value="Edit" rerender="blockId" rendered="{!!(tobeEdited == ln17.id)}">
    <apex:param assignTo="{!tobeEdited}" value="{!ln17.id}" name="ittobeedited"/>
</apex:commandbutton>
<apex:commandButton value="Save" action="{!saveRecord}" reRender="blockId" rendered="{!tobeEdited == ln17.id}"/>
</apex:column> 

<apex:column value="{!ln17.Org__c}" />

<apex:column headerValue="BMS Code">
    <!--Allows it to be edited-->
    <apex:inputfield value="{!ln17.BMS_Code__c}" rendered="{!tobeEdited == ln17.id}"/>
    <!--After Save-->
    <apex:outputField value="{!ln17.BMS_Code__c}" rendered="{!!(tobeEdited == ln17.id)}"/>
</apex:column>    

<apex:column value="{!ln17.License_Type__c}"/>

<apex:column headerValue="BU Agrees to Pay">
    <apex:inputfield value="{!ln17.BU_Agrees_to_Pay__c}" rendered="{!tobeEdited == ln17.id}"/>
    <apex:outputField value="{!ln17.BU_Agrees_to_Pay__c}" rendered="{!!(tobeEdited == ln17.id)}"/>
</apex:column> 

<apex:column value="{!ln17.Monthly_Unit_Price__c}" />

<apex:column headerValue="2017 Number Needed">
    <apex:inputfield value="{!ln17.X2017_Total_Needed__c}" rendered="{!tobeEdited == ln17.id}"/>
    <apex:outputField value="{!ln17.X2017_Total_Needed__c}" rendered="{!!(tobeEdited == ln17.id)}"/>
</apex:column>    

<apex:column headerValue="2017 Annualized Cost" value="{!ln17.X2017_Subtotal__c}" />

<apex:column headerValue="Estimated 2017 Cost" value="{!ln17.X2017_Cost__c}"/>


</apex:pageBlockTable>

</apex:pageBlock>

<!------------------------------------------------------------------------------------------>
<apex:pageBlock title="New Licenses Needed for 2017">

<apex:pageBlockTable value="{!wrappers}" var="wrapper" id="wtable">

<apex:column HeaderValue="Org">
<apex:inputField value="{!wrapper.lic.Org__c}" />
</apex:column>

<apex:column HeaderValue="Business Unit">
<apex:inputField value="{!wrapper.lic.Business_Unit__c}" />
</apex:column>

<apex:column HeaderValue="BMS Code">
<apex:inputField value="{!wrapper.lic.BMS_Code__c}" />
</apex:column>

<apex:column HeaderValue="License Type">
<apex:inputField value="{!wrapper.lic.License_Type__c}"  />
</apex:column>

<apex:column HeaderValue="BU Agrees to Pay">
<apex:inputField value="{!wrapper.lic.BU_Agrees_to_Pay__c}" />
</apex:column>

<apex:column HeaderValue="2017 Number Needed">
<apex:inputField value="{!wrapper.lic.X2017_Total_Needed__c}" />
</apex:column>

<apex:column HeaderValue="License Year">
<apex:inputField value="{!wrapper.lic.License_Year__c}" />
</apex:column>

</apex:pageBlockTable>


</apex:pageBlock>
<apex:commandButton value="Save" action="{!save}"/>


</apex:form>

<!--------------------------------------------------------------------------------------------------------->
</apex:page>

 
  • October 13, 2016
  • Like
  • 0
User-added image i need to create to page like this and i need to insert into a tab .can any one give a idea how to go through this