• Mohita Kalra
  • NEWBIE
  • 10 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 11
    Questions
  • 5
    Replies
Hi All ,
I have created a lightning component and that component is using record edit form. There are 4 custom picklist fields. When a user tries to select these fields , sometimes dropdown open upwards while sometimes downwards. When it open upwards , user is not able to see all values. User has to scroll the page down and then dropdown open downwards. 
Is there anyway we can open the dropdown downwards?
Basically , I dont want a profile to be able to delete a field when it goes to an object from set up , fields and relationships. There we have two options one is edit and other is delete. I dont want the profile to have delete option. Is it possible to restrict at that level ?
I have a recordEditForm with input fields. One of the field is a picklist.User-added imageBasically when I am trying to select Sub Branch , the picklist value is going inside of the form and I am not able to select other values....I have tried putting scroll bar too but that doesnt help. Can anyone please guide.
I have removed the data because of Data Privacy.
Its a long picklist but its going inside the form
 
This is my code:
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId" access="global" >
   <aura:attribute name="pageReference" type="Object"/>  
   <aura:handler name="init" value="this" action="{!c.doInit}"/> 
    <aura:attribute name="url" type="String"/>
    <aura:attribute name="accId" type="Id"/>
    <lightning:navigation aura:id="navService"/>
    <div style="background:#ffffff; margin:2px; border-radius: 2px; padding-left: 12px; padding-right: 12px; padding-top: 2px; padding-bottom: 7px;">
        <p style="font-size:90%;">
            
            <lightning:button variant="brand" label="New Case" title="New Case" onclick="{!c.mycomp}"/>
        </p>
    </div>    
</aura:component>

Component :
mycomp : function(component, event, helper){
        var navService = component.find("navService");
        
     var pageReference = {
                         "type": "standard__component",
                         "attributes": {
                                         "componentName": "c__NewCase"
                                       }, 
                         "state": {
                             recordId : component.get("v.recordId")
                                  }
                          };
       component.set("v.pageReference", pageReference);
     navService.navigate(pageReference);


This code is opening my component but i am getting undefined for recordId attribute.

doInit function in Controller of New Case component is :
var myPageRef = component.get("v.pageReference");
        
        component.set("v.parentRecordId",myPageRef.state.recordId);
        var accountId = component.get("v.parentRecordId");
        console.log("account id"+accountId);

I am getting undefined in recordID in new component
 
Hi All...I am creating a button , where I have to put brand as variant and also need to get lead icon on it...I tried something like this but the icon doesnt appear because of the brand...is there anyway I can change icon colour to white on this button.
<lightning:button onclick="{!c.createLead}"
                                      variant="brand"
                                      abel="New Lead"
                                      iconName="standard:lead"
                                      disabled = "false"/> 
User-added image
       
If I use variant as Brand_outline , I can see the lead icon...But I cant use Brand_Outine and have to use brand only...so i thought of getting the colour changed to white for this icon...so that it becomes visible.

<lightning:button onclick="{!c.createLead}"
                                      variant="brand-outline"
                                      abel="New Lead"
                                      iconName="standard:lead"
                                      disabled = "false"/> 

User-added image
Hi All, I want to get a case creation window with different page layouts depending upon the picklist values from few input fields. Any idea how this can be achieved ? Basically there has to be few picklist fields for input and based on different combinations of input selected , a new case window should open of a particular page layout.
I have a datatable which has column of type date. I want to set the default sorting order of the column. That means it should not allow the user to sort but date should be in order of latest date first. Is that possible ?
Component:
<aura:component>
    
    <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
    <aura:attribute name="intervalId" type="Integer" default="0"/>
    
    <div id="parentDIV" style="overflow:hidden">
        <p style="position:relative;" id="tofloat">
            <b><span style="color:red">Important Note : </span>
            I am Floating (Left to Right) Imformation...</b>
        </p>
    </div>
    
</aura:component>

Controller :
({
    doInit : function(component, event, helper) {
        var lWidth = window.innerWidth ;//Get the window's width
        //The setInterval() method calls a function or
        //evaluates an expression at specified intervals (in milliseconds).
        window.setInterval($A.getCallback(function() {
            helper.shiftDiv(component, event,lWidth);
        } ), 100);
    },
})

Helper :
({
    shiftDiv: function(component, event,lWidth) {
        var changeposition = component.get("v.intervalId");
        var floatElement = document.getElementById('tofloat');   
        if(changeposition < lWidth){
            floatElement.style.left = changeposition+'px';
            changeposition = changeposition + 5;
            component.set("v.intervalId",changeposition);
        }
        //reset the left to 0
        else{
            component.set("v.intervalId",0);
            floatElement.style.left = "0px";
            changeposition = component.get("v.intervalId");//resetting so as to hit the if block again
        }
    }
})

Can someone advise how can i achieve this. I used onmouseover in div tag but getting stuck at what function should be used?
PS : Have copied this code from sfdcmonkey
Hi,
I want to pass AccountId field value from init to handleRowAction function. Basically I need to set default value for Account Id in new case which I am creating from handleRowAction new case option.
This accountId value is getting returned from apex class in result variable.
({
    init: function (cmp, event, helper) {
        var actions = [{ label: 'New Case', name: 'new_Case' }];
            cmp.set('v.columns', [
            { label: 'Account Name', fieldName: 'AccountId', type: 'text' },
            { label: 'Name', fieldName: 'Name', type: 'Description' },
           { type: 'action', typeAttributes: { rowActions: actions } }
        ]);
        var action = cmp.get("c.fetchTheData"); //Calling Apex class controller 'getAccountRecord' method
             action.setParams({
                 recordId : cmp.get("v.recordId")
             });
        action.setCallback(this, function(response) {
            var state = response.getState(); //Checking response status
            var result = response.getReturnValue();
            if (cmp.isValid() && state === "SUCCESS")
                cmp.set("v.data", response.getReturnValue());  // Adding values in Aura attribute variable.   
           
        });
        $A.enqueueAction(action);
         },
    
    handleRowAction: function (cmp, event, helper) {
        var action = event.getParam('action');
        var row = event.getParam('row');

        switch(action.name) {
            case 'new_Case':
                var createRecordEvent = $A.get("e.force:createRecord");
                                createRecordEvent.setParams({
                             "entityApiName": "Case",
                                    "defaultFieldValues" : 
                                    {'AccountId' : result.AccountId}
                                    
                                    
                                     });
                                createRecordEvent.fire();
                break;
            
        }
    }
});
Hi, I need a popup screen of newcase(which we already have in salesforce) on select of a menuItem from a row and associate that case with one of the fields from selected row's parent? How can I achieve this ?
Code :
Component 1:
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes" access="global" >
  <aura:attribute name="pageReference" type="Object"/>  
    <aura:attribute name="url" type="String"/>
    <lightning:navigation aura:id="navService"/>
    <div>
     I am your first component !!
    </div>
  <aura:handler name="init" value="{!this}" action="{!c.mycomp}"/>
</aura:component>

Controller 1 :
({
    mycomp: function(cmp, event, helper) {
      var navService = cmp.find("navService");
      var pageReference = {
                         "type": "standard__component",
                         "attributes": {
                                         "componentName": "c__PQRTEST"
                                       }, 
                         "state": {
                             'message':'This is the target page'
                                  }
                          };
       cmp.set("v.pageReference", pageReference);
       const handleUrl = (url) => {
           window.open(url); };
           navService.generateUrl(cmp.get("v.pageReference")).then(handleUrl);}
})         

 
Hi
I am trying to query some fields of Account in query editor. 
select id,Alternate_Number_1__c,
            Alternate_Number_2__c,
            Alternate_Number_3__c,
            Phone,Student_Phone_Number__c
            from 
            Account 
I cross checked  in object manager and all these fields are there in account object. but I am getting this error.
select id,Alternate_Number_1__c,
          ^
ERROR at Row:1:Column:11
No such column 'Alternate_Number_1__c' on entity 'Account'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.

FYI  all these fields are there in Person Account records.
Basically , I dont want a profile to be able to delete a field when it goes to an object from set up , fields and relationships. There we have two options one is edit and other is delete. I dont want the profile to have delete option. Is it possible to restrict at that level ?
I have a datatable which has column of type date. I want to set the default sorting order of the column. That means it should not allow the user to sort but date should be in order of latest date first. Is that possible ?
I'm using lightning dataTable component.  But the sortedDirection only ever sorts one direction.  The sortDirection param never updates properly. Here is some code:
 
<aura:component implements="flexipage:availableForAllPageTypes" 
                controller="CrossSellActivityController"
                access="global">

  <!-- Attributes -->
  <aura:attribute name="activities" type="Array" />
  <aura:attribute type="String" name="sortedDirection" default="asc" />
  <aura:attribute name="columns" type="List" />

  <!-- Component DOM -->
  <div>
    <lightning:datatable keyField="id"
                         data="{!v.activities}"
                         columns="{!v.columns}"
                         sortedDirection="{!v.sortedDirection}"
                         onsort="{!c.updateColumnSorting}"
                         hideCheckboxColumn="true" />
  </div>

</aura:component>
Here is the column definition:
var columns = [
  { label: 'Program Key', fieldName: 'Program_Key__c', type: 'text', sortable: true },
  { label: 'Status', fieldName: 'Disposition__c', type: 'text', sortable: true },
  { label: 'User', fieldName: 'Username', type: 'text', sortable: true },
  { label: 'Asset', fieldName: 'Asset', type: 'text', sortable: true },
  { 
    label: 'Timestamp', 
    fieldName: 'CreatedDate', 
    type: 'date', 
    typeAttributes: {
      day: 'numeric',
      month: 'short',
      year: 'numeric',
      hour: '2-digit',
      minute: '2-digit',
      second: '2-digit',
      hour12: true
    },
    sortable: true
  }
];
component.set("v.columns", columns);
And where I console.log out the sortedDirection variable:
updateColumnSorting : function(component, event, helper) {
  var sortDirection = event.getParam('sortDirection');        
  component.set("v.sortedDirection", sortDirection);
  console.log('sortDirection: ', sortDirection);
},
The console.log always outputs 'asc' never flips to 'desc'.  I've even tried changing the definition to Boolean with no luck.
<aura:attribute type="Boolean" name="sortedDirection" default="false" />
I've also tried flipping it myself with a truthy check and setting it back on the sortedDirection attribute, but that doesn't work either.  Am I doing something wrong?


 
I have linked my lightning component with Quick action button,
but width of that pop-up has fixed width, my requirement is I want full screen to be acquire by that component.
through mew window or new tab,
How should I achieve this