• Basant Kr Verma
  • NEWBIE
  • 10 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 9
    Replies
Hi All,

I am facing issue with  Lightning:inputField with lightning:recordEditForm that when I am trying to programatically change the value of any field I am able to do only if user is not modifying that field manully on screen

What I mean is that, lets say I have a form using lightning:recordEditForm with only two fields of account which are Name and Type.
And I want a logic to introduce that, I want to add selected Type as Prefix on the Name field, I have created a on change method and doing it in that, and that is working as expected if user only changing the Type field
BUT if user first edit the Name field then select/change the Type its not.


Below is the my sample code
CustomRecordEditForm.cmp
<aura:component implements="flexipage:availableForAllPageTypes,forceCommunity:availableForAllPageTypes,force:lightningQuickAction,force:hasRecordId" access="global">
    <aura:attribute name="recordId" type="String"/>
    <div class="slds-container-outer">
        <div class="slds-container">
            <lightning:recordEditForm aura:id="recordViewForm" objectApiName="Account" recordId="{!v.recordId}">
                <lightning:messages />
                <lightning:inputField fieldName="Name" aura:id="Name" />
                <lightning:inputField fieldName="Type" aura:id="Type" onchange="{!c.handleTypeChange}"/>
            </lightning:recordEditForm>
        </div>
    </div>
</aura:component>

CustomRecordEditFormController.js
({
	handleTypeChange : function(component, event, helper) {
		var typeValue = component.find("Type").get("v.value");
        var nameValue = component.find("Name").get("v.value");
        if(typeValue != null && typeValue != '' && typeValue != undefined){
            if(nameValue.indexOf(":") > 0){
                nameValue = nameValue.split(':')[1];
            }
            component.find("Name").set("v.value",typeValue+":"+nameValue);
        }
	}
})

Thanks in Advance!
Hi Hive,

I am using custom lightning components in my napili community, we use to call @AuraEnabled methods on save which will perform desired operation.
In this calling we were able to pass a variable of standard/custom object types or wrapper class type

But after enabling "Locker Service" criticle update we are not able to pass object type variable as parameter, we are not even abale to send it after converting into JSON.

The only workaround which worked for me is passing each and every fields as parameters and assemble them again in apex method.
But this is also having issue if we have lots of fields on UI to send in Save method because we can't pass more then 32 parameters.

Any suggestion or workaround ?
Hi Hive,

I am using Salesforce Communities with Napili Template and have requirement to configure Header search component (Search Publisher) to work globally ALWAYS even if I am any topic detail page suggestion box should return exact same result as it returns when we are on Home page.

We have configurable property named as "Topic ID" for Search Result page (will appear after clicking on Search button) but did not find it for Header Search Publisher component which shows suggestions before clicking on Search Button.

Is there something I can do by configuration ?
Hi Hive,

I am using Salesforce Standard Communities (Napili Template)

I have a requirement to disable Topic auto suggestion while asking question to community (by clicking on 'Ask The Community' button)

Steps to reproduce
  1. Click on 'Ask The Community'
  2. Type 'what is a zero dollar receipt ?' in subject
  3. Type same in description
  4. Notice now you have "DOLLAR RECEIPT" in topic automatically
Ask The Community

I tried to hide it through Custom CSS but it still executing in background and added topics to question
Any suggestions ?
Hi Hive,

I am using Salesforce Communities (Napili template) and created a custom Community page for custom use

I want to have a page with some parameters as standard topic detail page having  (/topic/:topicId/:topicName) 

I want my page url to be like /customPage/:param1/:param2, but while creating page there is no option to set parameters.

Is there any way or work around for it ?

I already tried by setting  query parameters (/customPage?param1=value&param2=value) through javascript and read it in controller js but in this case these parameters are always there, they are not going away when we navigate to any other pages.
Hi All,

I am facing issue with  Lightning:inputField with lightning:recordEditForm that when I am trying to programatically change the value of any field I am able to do only if user is not modifying that field manully on screen

What I mean is that, lets say I have a form using lightning:recordEditForm with only two fields of account which are Name and Type.
And I want a logic to introduce that, I want to add selected Type as Prefix on the Name field, I have created a on change method and doing it in that, and that is working as expected if user only changing the Type field
BUT if user first edit the Name field then select/change the Type its not.


Below is the my sample code
CustomRecordEditForm.cmp
<aura:component implements="flexipage:availableForAllPageTypes,forceCommunity:availableForAllPageTypes,force:lightningQuickAction,force:hasRecordId" access="global">
    <aura:attribute name="recordId" type="String"/>
    <div class="slds-container-outer">
        <div class="slds-container">
            <lightning:recordEditForm aura:id="recordViewForm" objectApiName="Account" recordId="{!v.recordId}">
                <lightning:messages />
                <lightning:inputField fieldName="Name" aura:id="Name" />
                <lightning:inputField fieldName="Type" aura:id="Type" onchange="{!c.handleTypeChange}"/>
            </lightning:recordEditForm>
        </div>
    </div>
</aura:component>

CustomRecordEditFormController.js
({
	handleTypeChange : function(component, event, helper) {
		var typeValue = component.find("Type").get("v.value");
        var nameValue = component.find("Name").get("v.value");
        if(typeValue != null && typeValue != '' && typeValue != undefined){
            if(nameValue.indexOf(":") > 0){
                nameValue = nameValue.split(':')[1];
            }
            component.find("Name").set("v.value",typeValue+":"+nameValue);
        }
	}
})

Thanks in Advance!
Hi all,

I have a number of components that live in a utility bar in my lightning app. Some of them redirect the main page to another record. At the moment, the utility bar component remains open until the user clicks the minimize button. However, I want to minimize the utility bar component for them from the controller before the page redirects. Does anyone know how I'd go about doing this?

Many thanks,

Andy
Hi Hive,

I am using Salesforce Communities with Napili Template and have requirement to configure Header search component (Search Publisher) to work globally ALWAYS even if I am any topic detail page suggestion box should return exact same result as it returns when we are on Home page.

We have configurable property named as "Topic ID" for Search Result page (will appear after clicking on Search button) but did not find it for Header Search Publisher component which shows suggestions before clicking on Search Button.

Is there something I can do by configuration ?
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 Hive,

I am using Salesforce Communities (Napili template) and created a custom Community page for custom use

I want to have a page with some parameters as standard topic detail page having  (/topic/:topicId/:topicName) 

I want my page url to be like /customPage/:param1/:param2, but while creating page there is no option to set parameters.

Is there any way or work around for it ?

I already tried by setting  query parameters (/customPage?param1=value&param2=value) through javascript and read it in controller js but in this case these parameters are always there, they are not going away when we navigate to any other pages.

Hi there!
Is there a way to disable the Ask The Community feature on Communities?

Ask the Community

Many Thaks!


Best,
EF

Hi, 

 

I want to get the last modified date of a custom object definition in Apex or via WS.  Schema.DescribeSObjectResult doesn't have a method like getLastModifiedDate.  But this info is clearly available in the custom object definition detail page.  Is there anyway to get this in the Apex code?  Similarly I want to know the last modified date of a custom field definition, and I'm facing the same issue.

 

I also check the meta data API reference and cannot find anyway to get the last modified date of custom object definition.

 

Please point me to the right direction.

 

Thanks,

 

-Qin zhang

  • January 21, 2011
  • Like
  • 0