• Rakesh Chatty
  • NEWBIE
  • 25 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 10
    Questions
  • 9
    Replies

Hi All,

 

string templateId = '00XN0000002LbV8MAK';
string domainUrl = URL.getSalesforceBaseUrl().toExternalForm();
HttpRequest req = new HttpRequest();
req.setHeader('Authorization', 'Bearer ' + UserInfo.getSessionID());
req.setHeader('Content-Type', 'application/json');
req.setEndpoint(domainUrl+'/services/data/v51.0/tooling/query/?q=select+id,SenderType,templateId+from+WorkflowAlert+where+templateId=\''+templateId+'\'');
req.setMethod('GET'); 
Http h = new Http();
HttpResponse res = h.send(req);
system.debug(res.getBody());
Map<String, Object> deserialized = (Map<String, Object>)JSON.deserializeUntyped(res.getBody());
Object data1 = deserialized.get('records');
System.debug(deserialized.get('records'));
System.debug(deserialized.get('size'));

 

res.getBody(); -> {"size":1,"totalSize":1,"done":true,"queryLocator":null,"entityTypeName":"WorkflowAlert","records":[{"attributes":{"type":"WorkflowAlert","url":"/services/data/v51.0/tooling/sobjects/WorkflowAlert/01WN00000005esGMAQ"},"Id":"01WN00000005esGMAQ","SenderType":"CurrentUser","TemplateId":"00XN0000002LbV8MAK"}]}

 

Im trying to get ,"SenderType":"CurrentUser"  value but values is not returning: 

System.debug(deserialized.get('records')); --> [{"TemplateId":"00XN0000002LbV8MAK","SenderType":"CurrentUser","Id":"01WN00000005esGMAQ","attributes":{"url":"/services/data/v51.0/tooling/sobjects/WorkflowAlert/01WN00000005esGMAQ","type":"WorkflowAlert"}}]

 

How to get SenderType Value?

 

Thanks in Advance,

Hi all,
User-added imageIm trying to open convert lead page in lightning, based on conditions.

even i open this page in lighting using standard URL and passing ID it is opening in classic

('/lead/leadconvert.jsp?retURL=%2F{!Lead.Id}&id={!Lead.Id}')

is there any way to show this in lightning view by checking conditions.

Thank you.

Hi All,

I have a Quick action component for the edit button if the currently logged-in user is the owner of the record then the standard edit page. if not the owner then custom edit page.

<aura:component controller = 'clientExtension_Lex' implements="flexipage:availableForRecordHome,force:hasRecordId,force:lightningQuickAction" access="global" >
    <aura:attribute name="IsClientOwner" type="boolean" default="false"/>
    <aura:attribute name="fields" type="string[]" />
    <aura:handler name="init" value="{!this}" action="{!c.doinit}"/>
    <aura:if isTrue = "{!IsClientOwner}">
        <aura:method name="editRecord" action="{!c.editRecord}" access="public"></aura:method>
        <aura:set attribute = "else">
            <lightning:recordForm aura:id="myRecordForm" recordId="{!v.recordId}" objectApiName="Account" fields="{!v.fields}" columns="2" mode="edit" onsubmit="{!c.handleSuccess}" oncancel="{!c.closeModel}" />
        </aura:set>
    </aura:if>
</aura:component>
 
({
    doinit :function(component, event, helper) {
        var recordId = component.get('v.recordId');
        var action = component.get('c.clientdata');
        action.setParams({ recordId : recordId });
        action.setCallback(this, function(response) {
            var responseValue = response.getReturnValue(); 
			component.set("v.IsClientOwner",responseValue.IsClientOwner);	
            var fieldsetValues = [];
            for(var j =0 ; j<responseValue.editableFields.length; j++){
                for(var i =0 ; i<responseValue.wrapper.length ; i++){
                    if(responseValue.wrapper[i].show == true && responseValue.wrapper[i].customrecord.Field_API__c == responseValue.editableFields[j] && responseValue.wrapper[i].customrecord.editableField__c == true){
                        fieldsetValues.push(responseValue.editableFields[j]);
                    }
                }
            }
            fieldsetValues = [...new Set(fieldsetValues)]
            component.set("v.fields",fieldsetValues);
        });
        $A.enqueueAction(action);
        
    },
    
     editRecord: function(component, event, helper){
        var eventSource=event.getSource();
        var Id= component.get('v.recordId');
        alert(Id);
        var eRecord = $A.get("e.force:editRecord");
        eRecord.setParams({
            "recordId": Id
        });
        eRecord.fire();
    },
})
 

  if IsClientOwner is then I want to show the standard edit page.

Thanks in advance.

Hi, 
I have requirement where all Account fields should be  able to edit if he/she is the owner of record, if not only few fields.

Example:
Account Owner : User1
User1 : System Admin
User2 : System Admin

User 1 should be able to edit all fields no restrictions.
user 2 : only access to edit few fields.

can someone suggest how to fullful this requirement using out of box functionality like by using shariring rules, permission sets, field level security,etc.

Thanks in Advance.

Hi All, 

I Have Qucik Action Button Which calls Lc Componennt and LC component will navigate to LWC.

for now on click of Quick Action it is showing in same page.

i want to open in new page with custom URL.

can someone suggest me. 
here my code 

LC : Component
 

aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,force:lightningQuickAction,lightning:isUrlAddressable" >
    <lightning:navigation aura:id="navService"/>
    <aura:attribute name="pageReference" type="Object"/>
    <aura:handler name="init" action="{!c.navigateToLC}" value="{!this}" />
</aura:component>
 
 navigateToLC : function(component, event, helper) {
        var pageReference = {
            type: 'standard__component',
            attributes: {
                componentName: 'c__searchcomponent1_LWC'
            },
            state: {
                c__refRecordId: component.get("v.recordId")
            }
        };
        component.set("v.pageReference", pageReference);
        const navService = component.find('navService');
        const pageRef = component.get('v.pageReference');
        const handleUrl = (url) => {
            window.open(url);
            console.log(component.get("v.recordId"))
        };
        const handleError = (error) => {
            console.log(error);
        };
        navService.generateUrl(pageRef).then(handleUrl, handleError);
    }

Thanks in Advance.

Hi All,

I'm caling an LC component from Quick Actions which is navigatating to LWC component.
 > I want to open my component in new tab and change URL.
I'm able to change URL and open in new window but output is not showing.
can some suggest me how to change URL.

 

User-added image
I want URL to be /force.com/myComponentName/recid=123546

LC component
 

aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,force:lightningQuickAction,lightning:isUrlAddressable" >
    <lightning:navigation aura:id="navService"/>
    <aura:attribute name="pageReference" type="Object"/>
    <aura:handler name="init" action="{!c.navigateToLC}" value="{!this}" />
</aura:component>

JS
navigateToLC : function(component, event, helper) {
        var pageReference = {
            type: 'standard__component',
            attributes: {
                componentName: 'c__myComponent_Lwc'
            },
            state: {
                c__refRecordId: component.get("v.recordId")
            }
        };
        component.set("v.pageReference", pageReference);
        const navService = component.find('navService');
        const pageRef = component.get('v.pageReference');
        const handleUrl = (url) => {
            window.open(url);
            console.log(component.get("v.recordId"))
        };
        const handleError = (error) => {
            console.log(error);
        };
        navService.generateUrl(pageRef).then(handleUrl, handleError);
    }
User-added image

Thanks in Advance.
​​​​

i want to add color for <apex:outputField> label can someone suggest me how to change color to blue or red

apex:page standardController="contact"  recordSetVar="contacts" >
    <apex:pageBlock title="Contacts List" >
        <style>
        	.color{color:red;}
        </style>
        <apex:pageBlockSection title="contact" columns="2">
            <apex:repeat value="{!contacts}" var="a">
                <apex:outputField  value="{! a.lastName}" /> <br/>
                <apex:outputtext   value="{! a.lastName}" styleclass="color" /> <br/>
            </apex:repeat>
 </apex:pageBlock>
    
</apex:page>


 only for label text color should be red value should be black  

only Label should be red in color value should be in black as default.

 

thanks in adavance.

Hi,

Im trying to get editable fields and non editable fields and use them to iterate in visualforce using apex:repeat.

Apex:code
 
readOnlyFields   = new List<SObjectField>();
        accessableFields = new List<SObjectField>();
        for(SObjectField field :sObjectType.Account.fields.getMap().values()){
            if(field.getDescribe().isAccessible() && !field.getDescribe().isUpdateable() && !field.getDescribe().isCreateable()){
                readOnlyFields.add(field);
                nonEditableFields +=field + ',';
            }else{
                accessableFields.add(field);
                editableFields +=field + ',';
            }
        }



Vf Code:

 
<apex:repeat value="{!accessableFields}" var="a">
    <tr><td>{!selectedList1.[a]}</td></tr>
    </apex:repeat>



selectedList1 is an account type which contains account information.

can some one hep me to  avoid this error.
Error: Invalid field  for SObject Account

Thank you.

Hi, Im trying to display more than 10000 records i'm facing an error.

Visualforce Error
Help for this Page
Collection size 10,358 exceeds maximum size of 10,000.

Please find the code and suggest me.

VF Page:
<apex:page controller="Display10000" readOnly="true" >
    <apex:pageBlock title="{!size} records retrived">
        <apex:pageBlockTable value="{!accList}" var="a">
            <apex:column value="{!a.name}"  />
            <apex:column value="{!a.phone}"  />
            <apex:column value="{!a.AccountNumber}"  />
        </apex:pageBlockTable>
    </apex:pageBlock>
</apex:page>

 

Apex:

public class Display10000 {
    public  List<Account> accList {get; set;}
    public Integer size{get;set;}
   
    //constructor
    public Display10000(){
       accList = [Select Name,AccountNumber,Phone from Account]; 
       size = accList.size();
    }
}

please help me in retriving more than 10k records.

 

Thanks in advance.

 

In process builder when criteria satisfies immediate actions will get executed. My question is, if we have multiple immediate actions then which one will get executed first?  Please someone help me in understanding how exactly process builder works.

Thanks in advance

Hi All,

 

string templateId = '00XN0000002LbV8MAK';
string domainUrl = URL.getSalesforceBaseUrl().toExternalForm();
HttpRequest req = new HttpRequest();
req.setHeader('Authorization', 'Bearer ' + UserInfo.getSessionID());
req.setHeader('Content-Type', 'application/json');
req.setEndpoint(domainUrl+'/services/data/v51.0/tooling/query/?q=select+id,SenderType,templateId+from+WorkflowAlert+where+templateId=\''+templateId+'\'');
req.setMethod('GET'); 
Http h = new Http();
HttpResponse res = h.send(req);
system.debug(res.getBody());
Map<String, Object> deserialized = (Map<String, Object>)JSON.deserializeUntyped(res.getBody());
Object data1 = deserialized.get('records');
System.debug(deserialized.get('records'));
System.debug(deserialized.get('size'));

 

res.getBody(); -> {"size":1,"totalSize":1,"done":true,"queryLocator":null,"entityTypeName":"WorkflowAlert","records":[{"attributes":{"type":"WorkflowAlert","url":"/services/data/v51.0/tooling/sobjects/WorkflowAlert/01WN00000005esGMAQ"},"Id":"01WN00000005esGMAQ","SenderType":"CurrentUser","TemplateId":"00XN0000002LbV8MAK"}]}

 

Im trying to get ,"SenderType":"CurrentUser"  value but values is not returning: 

System.debug(deserialized.get('records')); --> [{"TemplateId":"00XN0000002LbV8MAK","SenderType":"CurrentUser","Id":"01WN00000005esGMAQ","attributes":{"url":"/services/data/v51.0/tooling/sobjects/WorkflowAlert/01WN00000005esGMAQ","type":"WorkflowAlert"}}]

 

How to get SenderType Value?

 

Thanks in Advance,

Hi All,

I have a Quick action component for the edit button if the currently logged-in user is the owner of the record then the standard edit page. if not the owner then custom edit page.

<aura:component controller = 'clientExtension_Lex' implements="flexipage:availableForRecordHome,force:hasRecordId,force:lightningQuickAction" access="global" >
    <aura:attribute name="IsClientOwner" type="boolean" default="false"/>
    <aura:attribute name="fields" type="string[]" />
    <aura:handler name="init" value="{!this}" action="{!c.doinit}"/>
    <aura:if isTrue = "{!IsClientOwner}">
        <aura:method name="editRecord" action="{!c.editRecord}" access="public"></aura:method>
        <aura:set attribute = "else">
            <lightning:recordForm aura:id="myRecordForm" recordId="{!v.recordId}" objectApiName="Account" fields="{!v.fields}" columns="2" mode="edit" onsubmit="{!c.handleSuccess}" oncancel="{!c.closeModel}" />
        </aura:set>
    </aura:if>
</aura:component>
 
({
    doinit :function(component, event, helper) {
        var recordId = component.get('v.recordId');
        var action = component.get('c.clientdata');
        action.setParams({ recordId : recordId });
        action.setCallback(this, function(response) {
            var responseValue = response.getReturnValue(); 
			component.set("v.IsClientOwner",responseValue.IsClientOwner);	
            var fieldsetValues = [];
            for(var j =0 ; j<responseValue.editableFields.length; j++){
                for(var i =0 ; i<responseValue.wrapper.length ; i++){
                    if(responseValue.wrapper[i].show == true && responseValue.wrapper[i].customrecord.Field_API__c == responseValue.editableFields[j] && responseValue.wrapper[i].customrecord.editableField__c == true){
                        fieldsetValues.push(responseValue.editableFields[j]);
                    }
                }
            }
            fieldsetValues = [...new Set(fieldsetValues)]
            component.set("v.fields",fieldsetValues);
        });
        $A.enqueueAction(action);
        
    },
    
     editRecord: function(component, event, helper){
        var eventSource=event.getSource();
        var Id= component.get('v.recordId');
        alert(Id);
        var eRecord = $A.get("e.force:editRecord");
        eRecord.setParams({
            "recordId": Id
        });
        eRecord.fire();
    },
})
 

  if IsClientOwner is then I want to show the standard edit page.

Thanks in advance.

Hi, 
I have requirement where all Account fields should be  able to edit if he/she is the owner of record, if not only few fields.

Example:
Account Owner : User1
User1 : System Admin
User2 : System Admin

User 1 should be able to edit all fields no restrictions.
user 2 : only access to edit few fields.

can someone suggest how to fullful this requirement using out of box functionality like by using shariring rules, permission sets, field level security,etc.

Thanks in Advance.

Hi...

I've created a flow in a Sandbox with Winter'21. I could not deploy it to production. I got the following error:
 Property 'filterLogic' not valid in version 49.0
Hi there,

I develop a custom component to call standard lead convert action.
I found this component runtime_sales_lead__convertDesktopConsole.
It works well. But Cancel action does not work. (See screenshot).

I call this component with parameters.

urlEvent.setParams({
"url": baseURL + '/lightning/cmp/runtime_sales_lead__convertDesktopConsole?leadConvert__leadId=' + recordId+ '&ws=%2Flightning%2Fr%2FLead%2F'+recordId+'%2Fview'
});

Maybe I should add a return URL for your component?
Can you send me a specification for this component with all parameters to solve this issue?User-added image

Hi, Im trying to display more than 10000 records i'm facing an error.

Visualforce Error
Help for this Page
Collection size 10,358 exceeds maximum size of 10,000.

Please find the code and suggest me.

VF Page:
<apex:page controller="Display10000" readOnly="true" >
    <apex:pageBlock title="{!size} records retrived">
        <apex:pageBlockTable value="{!accList}" var="a">
            <apex:column value="{!a.name}"  />
            <apex:column value="{!a.phone}"  />
            <apex:column value="{!a.AccountNumber}"  />
        </apex:pageBlockTable>
    </apex:pageBlock>
</apex:page>

 

Apex:

public class Display10000 {
    public  List<Account> accList {get; set;}
    public Integer size{get;set;}
   
    //constructor
    public Display10000(){
       accList = [Select Name,AccountNumber,Phone from Account]; 
       size = accList.size();
    }
}

please help me in retriving more than 10k records.

 

Thanks in advance.

 

In process builder when criteria satisfies immediate actions will get executed. My question is, if we have multiple immediate actions then which one will get executed first?  Please someone help me in understanding how exactly process builder works.

Thanks in advance