• Tanuj Tyagi
  • NEWBIE
  • 49 Points
  • Member since 2016
  • Software Consultant
  • Lirik Inc

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 7
    Questions
  • 26
    Replies
Hi,
I've hadded a lightning component's button to modify current opportunity via apex. 
I'm printing the result of the operation and in case of an error, I would like to print the error's message.
I'm inducing an error "update failed" but I can't seem to get the error message in the window
This is the part of my code to handle errors so far:
} else if (state === "ERROR") {
                var errors = response.getError();
                if (errors) {
                    if (errors[0] && errors[0].message) {
                        component.set("v.messageError", errors[0].message);
                    }
                    else {
                         component.set("v.messageError", errors.message);
                    } 
                } else {
                     component.set("v.messageError", "unknown error");
                }
}
<aura:iteration items="{!v.errorMessages2}" var="message2">
                        <li class="minli"><h3> ResultMessage: {!v.messageError} </h3></li>
</aura:iteration>
apex:
catch(Exception e) {
                throw e;
}

results:
WindowError in Logs


 
I have created Multiple translations for a custom label. Now I want to access the custom label translation in apex based on the Language preferred by the user on an input field in Lightning Component.
Is there any way to translated values in apex from a custom label?
I need to redirect User to the pinned list view of a certain object on the click of a custom button in the lightning component.
I can't see any field on list view object which specifies pinned list view.
Hi,
I am not able to load List View in Lightning Experience when using VF Page. 

On click of button in VF Page ------ 
I am calling this code :: 

if('{!$User.UITheme}'=='Theme4d') 
        { 
             var listViewId = '{!listViewId}'; /// List View Id , fettting from APEX- soql
             sforce.one.navigateToList(listViewId, 'All', 'Custom Object API');
        } 

I get this when list view page loads.

User-added image


Need urgent Help !!

Thanks

 
Hi All,

From past few days, after Winter 19 release. 
We are getting regular Warning Emails in Production org related to Governor Limits .
Below is the sample Email :

Subject: Apex governor limit warning

Caused the following Apex resource warnings:

Number of query locator rows: 10000 out of 10000

Please let me know if they can be ignored or is it something to be taken care of ?
Hi All,
I am trying to make Connect Salesforce with Java using Rest Api. But I am getting authentication Error and status = 400
I followed the all the steps mentioned here :
http://resources.docs.salesforce.com/204/17/en-us/sfdc/pdf/salesforce_developer_environment_tipsheet.pdf

Below is my Java Code:


public class Main {

    static final String USERNAME     = "tanujsfdcfsp@gmail.com";
    static final String PASSWORD     = "******************";
    static final String LOGINURL     = "https://login.salesforce.com";
    static final String GRANTSERVICE = "/services/oauth2/token?grant_type=password";
    static final String CLIENTID  = "***********";
    static final String CLIENTSECRET = "********************";

    public static void main(String[] args) {

        DefaultHttpClient httpclient = new DefaultHttpClient();

        // Assemble the login request URL
        String loginURL = LOGINURL + 
                          GRANTSERVICE + 
                          "&client_id=" + CLIENTID + 
                          "&client_secret=" + CLIENTSECRET +
                          "&username=" + USERNAME +
                          "&password=" + PASSWORD;

        // Login requests must be POSTs
        HttpPost httpPost = new HttpPost(loginURL);
       /// HttpGet httpGet  = new HttpGet(loginURL);
        HttpResponse response = null;

        try {
            // Execute the login POST request
            response = httpclient.execute(httpPost);
        } catch (ClientProtocolException cpException) {
            System.out.println("Exception: "+cpException);
            // Handle protocol exception
        } catch (IOException ioException) {
            // Handle system IO exception
        }

        // verify response is HTTP OK
        final int statusCode = response.getStatusLine().getStatusCode();
        if (statusCode != HttpStatus.SC_OK) {
            System.out.println("Error authenticating to Force.com: "+statusCode);
            // Error is in EntityUtils.toString(response.getEntity()) 
            return;
        }

        String getResult = null;
        try {
            getResult = EntityUtils.toString(response.getEntity());
        } catch (IOException ioException) {
            // Handle system IO exception
        }
        JSONObject jsonObject = null;
        String loginAccessToken = null;
        String loginInstanceUrl = null;
        try {
            jsonObject = (JSONObject) new JSONTokener(getResult).nextValue();
            loginAccessToken = jsonObject.getString("access_token");
            loginInstanceUrl = jsonObject.getString("instance_url");
        } catch (JSONException jsonException) {
            // Handle JSON exception
        }
        System.out.println(response.getStatusLine());
        System.out.println("Successful login");
        System.out.println("  instance URL: "+loginInstanceUrl);
        System.out.println("  access token/session ID: "+loginAccessToken);

        // release connection
        httpPost.releaseConnection();
    }
}
Hi, I am iterationg some records and i want to put images based on condition , I am comparing values in <aura:if>  but its not working.
Below is the code :

 <aura:iteration items="{!v.applicationList}" var="obj">
   <aura:if isTrue="{!obj.Status__c=='Approved'}">
       <i class=""><img src="/resource/1473844082000/app_approve"/></i>
  </aura:if>
   <aura:if isTrue="{!obj.Status__c=='In progress'}">
      <i class=""><img src="/resource/1473663683000/app_yell"/></i>  
   </aura:if>
   <aura:if isTrue="{!obj.Status__c=='Declined'}">            
      <i class=""><img src="/resource/1473844158000/app_pending"/></i>  
   </aura:if>          

</aura:iteration>


I tried with this code, but this is also not working,

<aura:if isTrue="{!obj.Status__c=='Approved'}">
<i class=""><img src="/resource/1473844082000/app_approve"/></i>
<aura:set attribute="else" >
  <aura:if isTrue="{!obj.Status__c=='In progress'}">
<i class=""><img src="/resource/1473663683000/app_yell"/></i>  
 <aura:set attribute="else" >
      <aura:if isTrue="{!obj.Status__c=='Declined'}">            

          <i class=""><img src="/resource/1473844158000/app_pending"/></i>    
<aura:set attribute="else">
          
          none
          </aura:set>
     </aura:if>
      </aura:set>
</aura:if>
</aura:set>
</aura:if>
How to add custom fields in the registration page of community portal ?
I found the default (selfRegister ) lightning component under lightning components bundle but changes made under that are not reflecting in the Portal.
Hi,
I am not able to load List View in Lightning Experience when using VF Page. 

On click of button in VF Page ------ 
I am calling this code :: 

if('{!$User.UITheme}'=='Theme4d') 
        { 
             var listViewId = '{!listViewId}'; /// List View Id , fettting from APEX- soql
             sforce.one.navigateToList(listViewId, 'All', 'Custom Object API');
        } 

I get this when list view page loads.

User-added image


Need urgent Help !!

Thanks

 
Hi All,

From past few days, after Winter 19 release. 
We are getting regular Warning Emails in Production org related to Governor Limits .
Below is the sample Email :

Subject: Apex governor limit warning

Caused the following Apex resource warnings:

Number of query locator rows: 10000 out of 10000

Please let me know if they can be ignored or is it something to be taken care of ?
I have a ightning component that needs to get a string from a class, but everytime open it I get a error "Uncaught Unknown controller action 'getTableauUrl'Callback failed: aura://ComponentController/ACTION$getComponent"  Why can't it find the method.

Compoenent

<aura:component controller="TableauSalesAnalysisLightningController" implements="force:appHostable" >

    <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
        <aura:attribute name="tableauUrl" type="string" />
        <div style="overflow:hidden; padding:4px; border: solid #ddd 2px; border-radius:4px;" >
           <iframe id="reportFrame" src="{!tableauUrl}" height="600PX" width="100%" scrolling="no" frameborder="0" style="position:relative;"/>
          </div>
</aura:component>

Controller:
({
    doInit : function(component, event, helper) {
      console.log('doInit called ');
      var action = component.get('c.getTableauUrl');
      console.log('action called '+action);

    
    }
})
Class  (I removed the logic for security)

public with sharing class TableauSalesAnalysisLightningController {
        public String tableauUrl;
            private User user;
            private Profile profile;
            private UserRole role;
            public String divisionId;
            public String regionId;
            public String userName;
            public String channel;
            public String allParam;
            public String dcio;


    // Load the tableau username into a static at page load since this won't change
@AuraEnabled
    public string getTableauUrl() {
      
            return tableauUrl;

    }


}
 
How do you set a dynamic aura attribute default value like current userinfo instead of hardcoding. See below.

The harcoding accountid works, not dynamic contactid/not supported.
 
<aura:attribute name="lookupcase" type="Case" default="{
		'sobjectType': 'Case',
        'ContactId': '{!v.userInfo.ContactId}',                                                
        'AccountId': '0012D000002oAkt'  
                                                         
	}"/>

 
Unable to create the Case in Salesforce lightning
Hello
I have two custom objects , fan__c    and   subscription__c

Fan object has fields (ID, email__c)

subscription object has fields(ID,fan_ID__c,mailing_list_name)

subscription object has a lookup to fan object as  : Fan_ID__cLookup(Fan)

pls help in framing the subscription query from child to parent where child is subscription object and parent is fan object.

I want to frame a query on subscription object that will fetch the related email of fan object

pls help me out
thanks
JohnD
 
Hi,
I've hadded a lightning component's button to modify current opportunity via apex. 
I'm printing the result of the operation and in case of an error, I would like to print the error's message.
I'm inducing an error "update failed" but I can't seem to get the error message in the window
This is the part of my code to handle errors so far:
} else if (state === "ERROR") {
                var errors = response.getError();
                if (errors) {
                    if (errors[0] && errors[0].message) {
                        component.set("v.messageError", errors[0].message);
                    }
                    else {
                         component.set("v.messageError", errors.message);
                    } 
                } else {
                     component.set("v.messageError", "unknown error");
                }
}
<aura:iteration items="{!v.errorMessages2}" var="message2">
                        <li class="minli"><h3> ResultMessage: {!v.messageError} </h3></li>
</aura:iteration>
apex:
catch(Exception e) {
                throw e;
}

results:
WindowError in Logs


 
I have an lightning component which is inherit in another lightning component. So on button click , i just set the attribute value  and use this value in ui:inputNumber tag in the child cmp. Attribute value is successfuly changed but it did not rerender on the cmp When the Locker Service is enabled. it workes fine without locker service.

Ex. of my cmp:

Parent cmp :
<div>
        <aura:iteration items="1,2,3,4,5" var="item">
            <c:TestVSOptionalExtra />
          </aura:iteration>
    </div>

Child cmp:

<aura:component implements="force:appHostable,forceCommunity:availableForAllPageTypes" access="global" >
    <aura:attribute name="quantity" type="Integer" default="0"/>
    <div>
        <ui:inputNumber class="center-aligned-number" disabled="false" value="{!v.quantity}" size="2"/>
        <ui:button aura:id="clicked" press="{!c.clickEvent}"> click me</ui:button>
    </div>
</aura:component>

JS controller :
({
    clickEvent : function(component, event, helper) {
        var eventType = event.getSource().getLocalId();
        var counter = component.get("v.quantity");  
        if (eventType === 'clicked') {            
            counter++;
        }
        component.set("v.quantity", counter);
//here quantity value is changed and appears in the log but did not change on the cmp UI.
        console.log(component.get("v.quantity"));
    }
})

While it works fine if i do not put this inside any cmp even the Locker service is enabled.
Hi All,

Please let me know how to implement show more button funtionaltiy with edit and delete buttons popup like below image in lightning component. 

User-added image

Regards,
Shaik
I want to build a custom lightning component to add/ delete new records on click of a button. 
i cant generate apex code after parsing any of the WSDL file
Need Help
HI experts, 

can any one suggest me how to migrate existing salesforce classic community to salesforce lightning,and also please let me know how we can create new community using salesforce lightning
Can you someone help me to call a controller from aura:iteration tag ?
<aura:iteration items="{!v.contacts}" var="c">
        <a href="{! '/'+c.Id}" >
        <p> {!c.Name} ( {!c.Birthdate} ) </p>    
        </a>
       <h6> {!c.Email}</h6>
        <ui:inputText label="Greetings !!" value="{!v.greeting}" />
        <ui:button label="Post" press="{!c.gsendmail}" />   
        <button type="button" onclick="{!c.gsendmail}" >Send</button>
    </aura:iteration>

I am able to call from outside aura:iteration but i am not able to do the same within aura:iteration. Basically for all the iteration items i need to put one input text and Post button to send an email by taking the input text field value.

Thanks
Brahma
Does anyone have any examples of how to make a jQuery get from a Lightning component using code similar to the below where the data will be returned from SOQL query in Salesforce

 jQuery.ajax({
            url: '/MCS/GetCar', 
            type: "GET",
            dataType: "json",

I am already aware of how to import the jquery library using '<ltng:require' and creating an @AuraEnabled method in Apex but it was wiring the rest together I was unsure about, I am relatively new to Lightning although aware of the basics.
hi folks !!! 

i want to know when to use SVG icons and when to use lightning icons . 

can you correct me , in winter 17 we can use direclty lightning icons instead of SVG ... can you please clarify it 
Hello,

I'm new to salesforce. I was trying to login using OAuth2 password flow using a RESTClient stub (in java), and getting the Internal Server Error. the url which I am trying is eu6.salesforce.com.

Can anybody help, in resolvoing the issue.

Thanks.