• Krishna.Avva
  • SMARTIE
  • 514 Points
  • Member since 2016

  • Chatter
    Feed
  • 14
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 3
    Questions
  • 118
    Replies
Hi there,

What can be possible problem in the following code ? Its giving me unexpected token on barcodeID.
My requirement is to fetch the record from Item custom object on the basis of the Barcode_ID and populate the Borrow custom object record using the information from Item object. Borrow object has lookup relationship with Item object. The values for barcode_id and employee_id are coming from the visualforce page.

public class BorrowController {
    public String employeeID {get; set;}
    public String barcodeID {get; set;}
    
    public BorrowController(){}
    
    public void createBorrowRecord() {
        Item__c item = [SELECT Name, Item_ID__c, Price__c, Status__c from Item__c where Barcode_ID__c = barcodeID];
        if(item != null) {
            Borrow__c b = new Borrow__c();
            b.Employee_ID__c = employeeID;
            b.Item_ID__c = item.Item_ID__c;
            b.Barcode_ID__c = barcodeID;
            b.Item_Price__c = item.Price__c;
        
            b.insert;
        }
        
    }
    
    public PageReference recordCreation() {
        createBorrowRecord();
    }
}

Any help would be greatly appreciated!
Hi everyone,

I have created a controller, but now need to add in FLS and CRUD enforcement.  I have checked the documentation, but have not found anything around enforcing FLS and CRUD for returning a public static list.

Can someone help me figure out how to add in the right FLS and CRUD security?

Here is my controller:
public with sharing class AllContactOppsController{
    public static Map<Id, String> recordtypemap {get;set;}
    
    @AuraEnabled    
    public static List<Object> myOpps(String currentRecordId) {
        List<OpportunityContactRole> oppresults = [SELECT Contact.name, Role, OpportunityId, Opportunity.CloseDate, Opportunity.allcontactopps__Record_Url__c, Opportunity.Amount,Opportunity.Name, Opportunity.StageName, Opportunity.Type FROM OpportunityContactRole WHERE contact.accountid=:currentRecordId]; 
        return oppresults;
    }
    
    @AuraEnabled        
    public static List<String> fetchRecordTypeValues(){
        List<Schema.RecordTypeInfo> recordtypes = Opportunity.SObjectType.getDescribe().getRecordTypeInfos();    
        recordtypemap = new Map<Id, String>();
        for(RecordTypeInfo rt : recordtypes){
            if(rt.getName() != 'Master')
            recordtypemap.put(rt.getRecordTypeId(), rt.getName());
        }        
        return recordtypemap.values();
    }
    
    @AuraEnabled
    public static Id getRecTypeId(String recordTypeLabel){
        Id recid = Schema.SObjectType.Opportunity.getRecordTypeInfosByName().get(recordTypeLabel).getRecordTypeId();        
        return recid;
    }   
}
Thanks,
Holly


 
Hi everybody,

based on this article (https://metillium.com/2018/04/collapsible-section-page-layout-record-display-lightning-components/) I've tried to adapt and implement a custom page layout with collapsible sections with lightning web component.
Currently everything works fine, BUT I didn't get it to work to open and close the section with transition so that is looks really smart.

Currently the ui looks like the following:
User-added image

In comparison with the standard pagelayout there are very small differences for the layout.

The arrow looks like a fat arrow:
User-added image

Could you give me a hint how to implement a transition to that the ui looks really smoothly and how to make my custom component look like teh standard layout section?
Is there also the possibility to change the text color?

Unfortunately I have only rudimentary knowledge about CSS.

Best regards,
Christian
 
Hi Everyone,

I am new to code and the new Salesforce Administrator foe my company. How do I revise Apex code to include additional lookup for allowed contact based on record type? I would also consider deleting it altogether.

Here is the full error message users are receiving.
Error: Invalid Data.
Review all error messages below to correct your data.
Apex trigger DealCorrespondenceNoteTrigger caused an unexpected exception, contact your administrator: DealCorrespondenceNoteTrigger: execution of AfterInsert caused by: System.DmlException: Update failed. First exception on row 0 with id a062K00001xpI1TQAU; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Only Contacts from the Account in the Deal Correspondence record are allowed.: [Contact__c]: Class.DealCorrespondenceNoteManager.DealCorrespondenceUpdateNote: line 13, column 1


Thank you for any help you are able to provide. Please advise if additional details are necessary.
Hi Team,

How to I create dropdown of tabs in a salesforce app?

Thanks,
S

I'm investigating how to integrate an online store with salesforce.
I'm wondering, best practices, where the data should reside in salesforce.
Once an order is placed in the online store, how is it represented. Would it create a closed opportunity with opportunity products as the line items?
Perhaps a separate Received payment object (custom?) in case of multiple/partial payments (not sure this is a requirement)
I noticed there is an standard order object that can be activated. Is this the area I should be investigating.

I'd love some insight into the overall object model, preferably using as much standard salesforce as is available.
Further down the road donations, and other form based 'sales' would also need to be tracked, some including $0 items if that matters.

Basically if you had a green field how would you proceed.
Hello,

I have a cutom button on click execute javascript.
How can i add this button to lightning pag layout

thanks for suggestion
Hello,

How is it possible to createa certificate and add a certificate during API call
Can i add this line
​​​​​​​  req.setClientCertificateName('certiname');


thank you for sugggestion
Hello all,
I'm trying to create a custom apex controller for a visualforce page, but no matter what i've tried, I cannot create an apex class in the developer console.  I am using a developer account, and am working in a developer org, and I still can't create apex classes. Is there something I am missing? Is there any alternative I can try to develop an apex class? 

Thank you in advance,
Connor
What is the call limit and data limit for an external rest API?  I am planning to write an APEX batch job what will be scheduled to run hourly.  This batch job will call an external Rest API up to 300 times and retrieve 4500 records which will be inserted as Big Objects.  Is this possible with Salesforce?
Hi!

I have two Android applications using the Salesforce SDK, the user will be redirect from the first app to the second one. How can I handle the user session to avoid make him login twice. It is possible to do this?

Thank you
Hi, 

 I am writing test class for below class but @future method is not getting covered. Please suggest me how to cover. 
public class CpqQuoteTriggerUtil {

    public static void createQuoteShareFromOpportunity(List<SBQQ__Quote__c> newLst) {
        system.debug('Calling CpqQuoteTriggerUtil.createQuoteShareFromOpportunity' + newLst);
        Map<ID,ID> optyQuoteMap = new Map<ID,ID>();
        List<SBQQ__Quote__share> insertShares = new List<SBQQ__Quote__share>();
        List<SBQQ__Quote__share> currentUserShare = new List<SBQQ__Quote__share>();
        for(SBQQ__Quote__c quote : newLst) {
            if(quote.SBQQ__Opportunity2__c <> null) {
                optyQuoteMap.put(quote.SBQQ__Opportunity2__c, quote.id);
            }
            currentUserShare.add(new SBQQ__Quote__share(UserOrGroupId = userinfo.getUserId(),
                                                ParentId = quote.id,
                                                AccessLevel = 'Edit'));
        }
        //Map<Id, List<SBQQ__Quote__share>> oppToQuoteShareLst = new Map<Id, List<SBQQ__Quote__share>>();
        Boolean notOppOwnerFlg = false;
        Set<Id> userids = new Set<Id>();
        ID OptyOwnerId;
        Id qid;
        //for Opportunity share
        for(OpportunityShare r : [SELECT Id, OpportunityId,Opportunity.ownerid, UserOrGroupId, OpportunityAccessLevel, 
                                            RowCause 
                                            FROM OpportunityShare 
                                            where opportunityid = :optyQuoteMap.keyset() and RowCause in('Rule', 'Team')]) {
            if(userids.isEmpty()) {
                userids.add(r.Opportunity.ownerid);
                OptyOwnerId = r.Opportunity.ownerid;
                qid = optyQuoteMap.get(r.OpportunityId);
            }
            if(!userids.contains(r.UserOrGroupId) ) {
                userids.add(r.UserOrGroupId);
                //insertShares = new List<SBQQ__Quote__share>();
                insertShares.add(new SBQQ__Quote__share(UserOrGroupId = r.UserOrGroupId,
                                                    ParentId = optyQuoteMap.get(r.OpportunityId),
                                                    AccessLevel = r.OpportunityAccessLevel == 'All' ? 'Edit': r.OpportunityAccessLevel));
                if(r.Opportunity.ownerid != userinfo.getUserId()) {
                    notOppOwnerFlg = true;
                }
                system.debug(insertShares);
            }
        }

        //for Default Opportunity Teams // sudhir Test here for 
        for(UserTeamMember r : [SELECT Id,OpportunityAccessLevel,OwnerId,TeamMemberRole,UserId 
                                                FROM UserTeamMember where ownerid   = :OptyOwnerId] ) {
                insertShares.add(new SBQQ__Quote__share(UserOrGroupId = r.UserId,
                                                    ParentId = qid,
                                                    AccessLevel = r.OpportunityAccessLevel));
        }
        system.debug('share from opty :: ' + insertShares);
        if(notOppOwnerFlg) {
            system.debug('for user share creator :: ' + currentUserShare);
            insertShares.addAll(currentUserShare);
        }

        Database.SaveResult[] srList = database.insert(insertShares, false);
        for (Database.SaveResult sr : srList) {
            if (sr.isSuccess()) {
                // Operation was successful, so get the ID of the record that was processed
                System.debug('Successfully inserted account. Account ID: ' + sr.getId());
            }
            else {
                // Operation failed, so get all errors                
                for(Database.Error err : sr.getErrors()) {
                    System.debug('The following error has occurred.');                    
                    System.debug(err.getStatusCode() + ': ' + err.getMessage());
                    System.debug('Account fields that affected this error: ' + err.getFields());
                }
            }
        }

    }
    public static void prepopulateApproverLevelFromOwner(List<SBQQ__Quote__c> newLst) {
        Set<id> opps = new set<id>();
            for(SBQQ__Quote__c quote : newLst) {
            if(quote.SBQQ__Opportunity2__c <> null) {
                opps.add(quote.SBQQ__Opportunity2__c);
            }
        }
        
        Map<id, Opportunity> optyMap = new Map<id, Opportunity>([select id, owner.SPR_Approver_Director_Level__c,owner.SPR_Approver_EVP__c,
                                                owner.SPR_Approver_GVP__c,owner.SPR_Approver_RVP__c,owner.SPR_Approver_GD_Group_Director__c,
                                                 owner.SPR_Approver_RD_Regional_Director__c
                                                 from opportunity where id = :opps]);
        //Approval
        for(SBQQ__Quote__c quote : newLst) {
            if(quote.SBQQ__Opportunity2__c <> null) {
                Opportunity opp = optyMap.get(quote.SBQQ__Opportunity2__c);
                    quote.ownerid = opp.ownerid;
                quote.CPQ_Approver_Director__c = opp.owner.SPR_Approver_Director_Level__c;
                quote.CPQ_Approver_RVP__c = opp.owner.SPR_Approver_RVP__c;
                quote.CPQ_Approver_GVP__c = opp.owner.SPR_Approver_GVP__c;
                quote.CPQ_Approver_EVP__c = opp.owner.SPR_Approver_EVP__c;
                quote.CPQ_Approver_RD_Regional_Director__c = opp.owner.SPR_Approver_RD_Regional_Director__c;
                quote.CPQ_Approver_GD_Group_Director__c = opp.Owner.SPR_Approver_GD_Group_Director__c;
            }
        }
    }

    public static void processQuoteOnBeforeUpdate(Map<Id, SBQQ__Quote__c> newMap, Map<Id, SBQQ__Quote__c> oldMap){
        for(SBQQ__Quote__c q : newMap.values()) {
            SBQQ__Quote__c oldQ = oldMap.get(q.Id);
            system.debug(q.CPQ_Quote_Remaining_Claim_Status__c  + '_'+ q.CPQ_Quote_Product_Count__c + '_'+oldQ.CPQ_Closed__c );
            if(q.CPQ_Quote_Remaining_Claim_Status__c  <= 0 && q.CPQ_Quote_Product_Count__c > 0 && oldQ.CPQ_Closed__c == false) {
                q.CPQ_Closed__c = true;
            } else {
                q.CPQ_Closed__c = false;
            }
            system.debug(q.CPQ_Closed__c +'_');
        }
    }
    
    public static void processQuoteOnAfterUpdate(Map<Id, SBQQ__Quote__c> newMap, Map<Id, SBQQ__Quote__c> oldMap){
        Set<ID> Idset = new Set<ID>();
        for(SBQQ__Quote__c q : newMap.values()) {
            SBQQ__Quote__c oldQ = oldMap.get(q.Id);
            if(q.CPQ_Quote_Remaining_Claim_Status__c  <= 0 && q.CPQ_Quote_Product_Count__c > 0 && q.CPQ_Closed__c == true && oldQ.CPQ_Closed__c == false) {
                Idset.add(q.Id);
            }
        }

        if(!IdSet.isEmpty()) {
            updateOpportuntiy(IdSet);
        }
    }

    @future
    public static void updateOpportuntiy(Set<Id> Idset){
        Set<Id> oppIdSet = new Set<Id>();
        List<Opportunity> oppLst = new List<Opportunity>();
        system.debug(Idset);
        for(SBQQ__Quote__c q : [select id, name, CPQ_Distributor__r.name, SBQQ__Opportunity2__c, SBQQ__Opportunity2__r.stageName                                               
                                                                                      from SBQQ__Quote__c 
                                                                                      where id in :IdSet and 
                                                                                      (CPQ_Distributor__r.name like 'US -%' Or CPQ_Distributor__r.name like 'CAN -%' OR CPQ_Distributor__r.name like 'LAT -%' )] ){
            if(!oppIdSet.contains(q.SBQQ__Opportunity2__c)) {
                oppIdSet.add(q.SBQQ__Opportunity2__c);
                Opportunity opp = new opportunity(id = q.SBQQ__Opportunity2__c);
                if(q.CPQ_Distributor__C != null) { 
                        If((q.CPQ_Distributor__r.name.Startswith('US -') || q.CPQ_Distributor__r.name.Startswith('CAN -'))
                            &&  (q.SBQQ__Opportunity2__r.stageName != 'P.O. Issued,Fortinet can Ship & Invoice' && q.SBQQ__Opportunity2__r.stageName != 'Closed Won - All Products on Leaderboard')) {
                        opp.stageName = 'P.O. Issued,Fortinet can Ship & Invoice';
                        oppLst.add(opp);
                    }  else If (q.CPQ_Distributor__r.name.Startswith('LAT -') 
                            &&  q.SBQQ__Opportunity2__r.stageName != 'Closed Won - All Products on Leaderboard') {
                        opp.stageName = 'Closed Won - All Products on Leaderboard';
                        oppLst.add(opp);
                    }
                }
            }
            system.debug(oppLst);
            if(!oppLst.isEmpty()) {
                update oppLst;
            }
        }
    }
        /*
    public static void lockAfterApproval(List<SBQQ__Quote__c> newQ, List<SBQQ__Quote__c> oldQ) {
    
    SBQQ__Quote__c blankQuote = new SBQQ__Quote__c();
    Schema.SObjectType objType = blankQuote.getSObjectType();
    Map<String, Schema.SObjectField> fieldMap = Schema.SObjectType.SBQQ__Quote__c.fields.getMap();
        
            
        
    } 
    
        private static void updateSPRAndCategoryMetrics(List<SBQQ__QuoteLine__c> sprProductList, String sprId) {
    
}*/
}
User-added image

Above code is not covered. 

Below is the test class writter it is having only 67% code coverage
@isTest(seealldata=true)
public class CpqQuoteTriggerUtilTest
{  
    public static testMethod void method1(){
        
        Profile profileObj =[select id from Profile where name='System Administrator' limit 1];
        User u = new User(
            FirstName = 'Sudhir',
            LastName = 'Testing Usre',
            Alias = 'tstN',
            Email = 'test11@abc.com',
            Username = 'partne1r11@abc.com',
            CommunityNickname = 'testi11',
            emailencodingkey = 'UTF-8',
            languagelocalekey = 'en_US',
            localesidkey = 'en_US',
            timezonesidkey = 'America/Los_Angeles',
            profileId = profileObj.Id,
            spr_region__c = 'LATAM',
            NFR_User__c  = false,
            SPR_to_Forticare_Linking__c = true
        );
        insert u;
        
        Distributor__c Dist = [select id from Distributor__c where CPQ_DistributorStatus__c  = true limit 1];
        
        Account Pact = [select id from account where recordtype.name = '.Partner' and Is_In_RV_Portal__c = true and Partner_Status__c = 'Activated' limit 1];
        
        Contact Pcnt = [select id from contact where accountid = :Pact.id  limit 1];    
        
        Account Act = new Account( Name = 'Test Sudhir Ac',Website='www.sudhir.com',Industry='Legal',BillingStreet='894', BillingCity='sunnyvalley', BillingState='CA', 
                                  BillingPostalCode='997',BillingCountry='United States',Customer_Status__c='Current Customer');  
        
        insert Act; 
        
        Contact C = [select id from contact limit 1];
        
        Opportunity opp = new Opportunity(
            AccountId=Act.id,
            StageName='Omit from Forecast',
            Amount = 0,
            Name = 'Test Sudhir',
            CloseDate = Date.today(),
            Market_Segmentation__c = 'Education',
            End_User_Industry__c = 'Education',
            End_Customer_Country__c = 'United States',
            Deal_Type__c='Refresh',
            Primary_Opportunity_Contact__c =  c.id,
            Distributor__c = Dist.id
        );
        
        insert opp;
        
        OpportunityTeamMember oppmem = new OpportunityTeamMember(
            Opportunityid = opp.id,
            OpportunityAccessLevel = 'Read' ,
            TeamMemberRole = 'CAM',
            Userid = u.id ); 
        
        
        insert oppmem;
        
        
        
        SBQQ__Quote__c SQ = new SBQQ__Quote__c(SBQQ__Opportunity2__c = opp.id,
                                               CPQ_Distributor__c = Dist.id,
                                               CPQ_Partner_Account__c = Pact.id,
                                               CPQ_Partner_Contact__c = Pcnt.id
                                              );
        
        
        insert SQ;
        
        
        
        SBQQ__Quote__share SQS = new SBQQ__Quote__share(UserOrGroupId = u.id,
                                                        ParentId = SQ.id,
                                                        AccessLevel  = oppmem.OpportunityAccessLevel
                                                       );
        
        insert SQS;
        
        
        
        opp.stageName = 'P.O. Issued,Fortinet can Ship & Invoice';
        opp.Partner_Initiated__c = 'No';
        
        update opp;
        
    }
    
 
    
}

 
I am trying to reuse a piece of code I've used many times before. The code schedules a batch class from another Apex class. When I try to edit it in Developer Console or an IDE, I get the following error: "Method does not exist or incorrect signature: void scheduleBatch(testBatch, String, Decimal) from the type System". testBatch IS a batchable class. Why is the compiler pulling the NAME of the batchable class into the method?

Here is my code:
Apex class:
public class testClass {
    public static void testSchedule() {
        testBatch batchable = new testBatch();
        String jobName = 'testBatch';
        Decimal minutesFromNow = 0.0;

        try {
            String cronId = System.scheduleBatch(batchable, jobName, minutesFromNow);
            CronTrigger ct = [SELECT Id, NextFireTime FROM CronTrigger WHERE Id = :cronID];
            System.debug(jobName + ' jobId: ' + cronID);
            System.debug(jobName + ' next fire time: ' + ct.NextFireTime);
        } catch (Exception e) {
            System.debug('Error scheduling batch: '+e.getMessage());
        }
    }
}

Here is the batch class:
global class testBatch implements Database.Batchable<sObject> {
    private static String query;

    global Database.QueryLocator start(Database.BatchableContext BC){
        return Database.getQueryLocator(query);
    }

    global void execute(Database.BatchableContext BC, List<sObject> scope){
    }

    global void finish(Database.BatchableContext BC){
    }
}
Thanks in advance!
Hello,

I wanted to know, how can i create a hyperlink anddisplay it in a section of the Opportunity.

The use casecab be achived by formulawith hyperlink, bu i want the same usecase with button

Thank you for suggestion
Hi All,

After Spring 2020 is enabled in the sandbox - whenever we try to launch a report in Lightning experience, the console is logging these errors:

Attempted to fetch label "ExplorerEditRelationship.leftBlendTitle" before the app has been loaded.
Attempted to fetch label "ExplorerEditRelationship.leftBlendDescription" before the app has been loaded.
Attempted to fetch label "ExplorerEditRelationship.rightBlendTitle" before the app has been loaded.
Attempted to fetch label "ExplorerEditRelationship.rightBlendDescription" before the app has been loaded.
Attempted to fetch label "ExplorerEditRelationship.innerBlendTitle" before the app has been loaded.
Attempted to fetch label "ExplorerEditRelationship.innerBlendDescription" before the app has been loaded.
Attempted to fetch label "ExplorerEditRelationship.fullBlendTitle" before the app has been loaded.
Attempted to fetch label "ExplorerEditRelationship.fullBlendDescription" before the app has been loaded.

Is anyone facing the same issue?
Hi,

I am trying to bring in Tableau dashboards into Salesforce. All the connections are working fine. I get OK on all the status checkes between Salesforce, Sparkle and Tableau servers. However, when i launch the VF Page which has the canvas app(which should display the Dashboard ideally), I get the following error:

SPARKLER ERROR: Unable to process request. Check parameters/environment variables are set correctly.

Please let me know if someone has faced this issue before and how did they solve it. Thanks for your time.
In the Critical Update. 
Salesforce has told that. For the direct access of the custom settings. We need to give the permission for that person.

And this is not applicable for apex. but this will affect the lightning component.
Can i know how can we access the lightning component directly.
Hi there,

What can be possible problem in the following code ? Its giving me unexpected token on barcodeID.
My requirement is to fetch the record from Item custom object on the basis of the Barcode_ID and populate the Borrow custom object record using the information from Item object. Borrow object has lookup relationship with Item object. The values for barcode_id and employee_id are coming from the visualforce page.

public class BorrowController {
    public String employeeID {get; set;}
    public String barcodeID {get; set;}
    
    public BorrowController(){}
    
    public void createBorrowRecord() {
        Item__c item = [SELECT Name, Item_ID__c, Price__c, Status__c from Item__c where Barcode_ID__c = barcodeID];
        if(item != null) {
            Borrow__c b = new Borrow__c();
            b.Employee_ID__c = employeeID;
            b.Item_ID__c = item.Item_ID__c;
            b.Barcode_ID__c = barcodeID;
            b.Item_Price__c = item.Price__c;
        
            b.insert;
        }
        
    }
    
    public PageReference recordCreation() {
        createBorrowRecord();
    }
}

Any help would be greatly appreciated!

Hi there,

I have been working to setup a workflow where an email notification is sent to all opportunity split owners when a user logs a call on an opportunity. 

As of now, I have a process setup to determine when a task is logged onto an opportunity, but need to figure out how to determine 1. what the opportunity is, 2. if that opportunity is a split and 3. who the opportunity split owners are.

I spoke with Salesforce Support and another user on the Trailblazer forum and am stuck with designing a flow that will query on the opportunity split object using the getreads element. I am relatively new to flows so still trying to figure out how this would be handled. Would anyone be able to help with a technical walkthrough of this?

Thanks so much

Can someone help. 

I'm trying to remove a section from a visualforce page and keep getting this error. The section to be removed is below. 


Error: LandRoverCalltoAction line 238, column 15: The element type "apex:form" must be terminated by the matching end-tag "</apex:form>"


Error: The element type "apex:form" must be terminated by the matching end-tag "</apex:form>".

 
<div class="form-section">
                            <div class="form-row">
                                <div class="form-field">
                                    <label class="form-field__label" for="searchField">Postcode</label>
                                    <div class="postcode__input">
                                        <div class="form-field__input">
                                            <apex:inputField id="searchField" value="{!Account.Postcode_Hidden__c}" required="true"/>
                                        </div>

                                        <input id="searchButton" class="form-button form-button--primary" type="button"
                                               onclick="findByPostcode()" value="Find" />

                                    </div>

                                    <div id="selectDropdownDiv" class="selectDropdownDiv">
                                        <label class="form-field__label" for="addressListSelect">Please select your address</label>
                                        <select id="addressListSelect" class="addressListSelect"></select>
                                    </div>
                                    <div class="errorDateMsg" id="errorAddrMsg" style="display: none">Please type the postcode and select your address</div>

                                    <div id="form-address" class="form-address">
                                        <output id="output-address1"></output>

                                        <output id="output-town"></output>

                                        <output id="output-postcode"></output>
                                    </div>

                                    <div id="form-address-apex" class="form-address-apex">
                                        <apex:inputField id="form__address_1" required="true" value="{!Account.BillingStreet}"/>
                                        <apex:inputField id="form__city" value="{!Account.BillingCity}"/>
                                        <apex:inputField id="postcode__box" value="{!Account.BillingPostalCode}"/>
                                    </div>
                                    
                                </div>
                            </div>

                        </div>


 
I have installed Eclipse, but can't connect to force.com IDE getting an error.

Force.com IDE
iam using SLDS to show Accordion dinamically but here i am having some issue to show single Selection 
when i click on single account record it is expanding all the list of account
User-added imageUser-added imagehere is my component and controller
<!--Component-->
<aura:component implements="flexipage:availableForAllPageTypes,force:hasRecordId" access="global" controller = "AccountController">
	<!--Attributes-->
            <aura:attribute name="showEditable" type="Boolean" default = "false"/>
            <aura:attribute name="showReadable" type="Boolean" default = "true"/>

    <aura:attribute name="accountList" type="Account[]"/>
        <aura:attribute name="isexpanded" type="Boolean"/>

    <!--handler-->
    <aura:handler name="init" value="{! this }" action="{! c.doInit }"/>

 
     <lightning:card title = "Account Accordian" variant = "narrow">
    <ul class="slds-accordion">
        <aura:iteration items="{!v.accountList}" var="account">
            <li class="slds-accordion__list-item">
                <div class="{! 'slds-accordion__section' + (v.isexpanded ? 'slds-is-open' : '')}">
                    <div class="{! 'slds-section' + (v.isexpanded ? ' slds-is-open' : '')}">
                        <h3 class="slds-section__title slds-theme_shade">
                            <button aura:id = "{! account.Id}" aria-controls="{! account.Id}" aria-expanded="{!v.isexpanded}" onclick="{!c.changeState}" class="slds-button slds-section__title-action">
                                <span class="slds-truncate" title="Section Title">
                                <ui:outputText aura:id="Id" value="{! account.Name}"/>
                                </span>
                            </button>
                        </h3>
                        <div class="slds-section__content" aria-hidden="{!!v.isexpanded}" id="{! account.Id}">
                            <div class="slds-form slds-form_compound" style="width:40%;">
                                Account details                                                               
                                <aura:if isTrue="{! v.showReadable}">
                                <c:AccountDetailsComponent recordId="{! account.Id}"/>
                                <lightning:button variant="brand" label="Edit" onclick="{! c.EditShow }" />
                                </aura:if>
                                <aura:if isTrue="{! v.showEditable}">
                                    <c:editableRecordLDS recordId="{! account.Id}"/>
                                </aura:if>
                            </div>
                        </div> 
                    </div>     
                </div>
            </li>
        </aura:iteration>
        </ul>
    </lightning:card>
</aura:component>
 
//Controller
({    
    doInit : function(component, event, helper) {
        
        var action=component.get('c.getAccountList');
        
        action.setCallback(this,function(response){
            var state = response.getState();
            console.log('state ='+state);
            if (component.isValid() && state === "SUCCESS") {
               
                component.set("v.accountList", response.getReturnValue());
                console.log('v.accountList='+JSON.stringify(response.getReturnValue()));
              }
        });
    $A.enqueueAction(action);
        
    },
  EditShow : function(component, event, helper) {
  	component.set("v.showEditable","true");
        
      component.set("v.showReadable","false");

  },
 changeState : function changeState (component){ 
   component.set('v.isexpanded',!component.get('v.isexpanded'));
 }
})

so please help me with my Accordion component how can i expand only one row using SLDS only
Hi all & thanks for taking the time to read this.

I'm working on a project which requires a rest api call to an external site.  As the external company haven't completed their work yet I thought I'd get ahead of the curve & write a simulation of their code on one of our sanboxes so I can test my code which is running in another sandbox.  However I get a [Status=Bad Request, StatusCode=400] response when requesting an authorisation code before I even get to the point of the real request.  I can boil down this request down to (where the client_id etc. obviously have the correct values):-
 
HttpRequest req = new HttpRequest();
Http http = new Http();
String authUrl = 'https://test.salesforce.com/services/oauth2/token?grant_type=refresh_token' +
                            '&client_id=' + 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXX' +
                            '&client_secret=' + 'YYYYYYYYYYYYYYYYYYYYYYYYYYYYY' +
                            '&refresh_token=' + 'ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ';

string reqBody = 'sss';

req.setHeader('Content-Type', 'application/json;charset=UTF-8');

req.setMethod('POST');
req.setEndpoint(authUrl);
system.debug(authUrl);


HTTPResponse resp = http.send(req);
system.debug(resp);
Bizarrelyif I log in to workbench using the sandbox that is sending the request & go to the Rest Explorer & use the value in the variable authUrl without the https://test.salesforce.com (so starting /services/oauth2/token?grant_type=refresh_token...) it works fine.

Any suggestions as this is driving me crazy?  

Thanks for any help you can offer.

Praenei
 
I have a apex class with 'Without Sharing' annotation and i am calling a future method. The future method is not allowing some users (Non Admin)  to delete objectTerritory2Association records. showing insufficient access- read only access. Since i am running the class with 'Without Sharing' it must not throw an error right? but is throwing. 

Thanks,
Gopinath
Hi

I want to get the current month from picklist field and use that current month in soql query in a batch class. I have written the following code and its not working. 
Any help is appreciated.

String month = Product.Month__c.month();
Set<String> ple = new Set<String> {'Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'};
String query = 'Select Id, Name, Month__c from Product where CALENDAR_MONTH(Month__c) = :month';

 
We are trying to replace custom settings with Named credentials in one of our application. So we are trying to move all custom settings data into named credentials and trying to connect the third party application using Per User (Identity Type) Password Authentication (Authentication Protocol) Named credential, getting the 401-Unauthorized error.

Named Credentials Created:
Identity Type - Per User
Authentication Protocol - Password Authentication

Code Snippet executed in Anonymous window:
String method = 'POST';
String IMPLCaseId = 'IM-25147';
String RelatedIMPLCaseId;
String groupNumber = 'A1723';

GCwGetBPIDRequest.QQGroupInfo qqgroupInfo = new GCwGetBPIDRequest.QQGroupInfo(IMPLCaseId, RelatedIMPLCaseId, groupNumber);
GCwGetBPIDRequest getBPIDReq = new GCwGetBPIDRequest();
getBPIDReq.ServiceType = 'IMPL';
getBPIDReq.SFDCUserName = [select Id, Name, username from User where Id = :UserInfo.getUserId()].Name;
getBPIDReq.SubType = 'GetBPID';
getBPIDReq.Implementation = qqgroupInfo;

System.debug(' getBPIDReq### ' + getBPIDReq);

HttpRequest req = new HttpRequest();
HttpResponse res = new HttpResponse();
req.setEndpoint('callout:API_Pega_Callout_PegaUser1/PRRestService/P2EREST/Account/ProcessServiceRequest');
req.setMethod('POST');

req.setBody(getBPIDReq.generate());
req.setTimeOut(120000);

system.debug('req.getEndpoint ---------------> ' + req.getEndpoint());
system.debug('req.getHeader ---------------> ' + req.getHeader('Authorization'));
system.debug('HTTP REQUEST BODY ---------------> ' + req.getBody());

Http http = new Http();
res = http.send(req);
system.debug('HTTP RESPONSE BODY ---------------> ' + res.getBody());

Getting the Below Error:
Error 401--Unauthorized:
The request requires user authentication. The response MUST include a WWW-Authenticate header field (section 14.46) containing a challenge applicable to the requested resource. The client MAY repeat the request with a suitable Authorization header field (section 14.8). If the request already included Authorization credentials, then the 401 response indicates that authorization has been refused for those credentials. If the 401 response contains

What could be the possible reason for this? 
Any help would be appreciated.

I'm looking for some advice on how to add a button to our opportunity page that will present the user with a drop-down and based on the selection option, generate an email using a specific template based on the selection.  

I've seen it done via javascript but since js buttons are being phased out, I need a different solution.

Thank you for your help.

We are developing components for a Community that will used in a mobile app via Mobile Publisher.  From what I have read, I have the impression that Lightning Web Components (vs. Aura) provides greater flexibility for mobile apps.  Please confirm.
Hi everyone,

I have created a controller, but now need to add in FLS and CRUD enforcement.  I have checked the documentation, but have not found anything around enforcing FLS and CRUD for returning a public static list.

Can someone help me figure out how to add in the right FLS and CRUD security?

Here is my controller:
public with sharing class AllContactOppsController{
    public static Map<Id, String> recordtypemap {get;set;}
    
    @AuraEnabled    
    public static List<Object> myOpps(String currentRecordId) {
        List<OpportunityContactRole> oppresults = [SELECT Contact.name, Role, OpportunityId, Opportunity.CloseDate, Opportunity.allcontactopps__Record_Url__c, Opportunity.Amount,Opportunity.Name, Opportunity.StageName, Opportunity.Type FROM OpportunityContactRole WHERE contact.accountid=:currentRecordId]; 
        return oppresults;
    }
    
    @AuraEnabled        
    public static List<String> fetchRecordTypeValues(){
        List<Schema.RecordTypeInfo> recordtypes = Opportunity.SObjectType.getDescribe().getRecordTypeInfos();    
        recordtypemap = new Map<Id, String>();
        for(RecordTypeInfo rt : recordtypes){
            if(rt.getName() != 'Master')
            recordtypemap.put(rt.getRecordTypeId(), rt.getName());
        }        
        return recordtypemap.values();
    }
    
    @AuraEnabled
    public static Id getRecTypeId(String recordTypeLabel){
        Id recid = Schema.SObjectType.Opportunity.getRecordTypeInfosByName().get(recordTypeLabel).getRecordTypeId();        
        return recid;
    }   
}
Thanks,
Holly


 
I grabbed the trigger below from a website but it keeps comparing null values on the Lead object to null values on the Account object. 

Basically, I just want to make sure that when Addy_Account_Id__c is entered on the Lead object, it checks if there are any Accounts with a matching Addy_Account_Id__c. If they do match, the SFDC Account Id should be stamped on the Lead record in the "Convert_To_Existing_Account__c " field. 

However, this trigger is matching based on null values. I would like to exclude those. Please Help!!!
 
trigger pullSFDCaccountonlead on lead (before update) {

    Set<String> codes = new Set<String>();
    for (lead o : trigger.new) codes.add(o.Addy_Account_Id__c );

    Map<String, Account> siteAccounts = new Map<String, Account>();
    for (Account a : [
        SELECT Addy_Account_Id__c FROM Account
        WHERE Addy_Account_Id__c IN :codes
    ]) siteAccounts.put(a.Addy_Account_Id__c , a);

       for (lead o : Trigger.new)
    {
        Account siteAccount = siteAccounts.get(o.Addy_Account_Id__c );
       Id parentId = (siteAccount != null) ? null : siteAccount.Id;
        o.Convert_To_Existing_Account__c = parentId;
    }
}

 
Hello, I have a SOAP callout to an external webservice and I'd like to retrieve the records from the external service and insert them into Salesforce. If I query on a specific record from the external system, I can insert that record into Salesforce. However when I query on multiple records, they're not being inserted into SF. I tried creating a while loop and adding the records to a list and then insert the list, but that hasn't worked. Any help would be appreciated. Thank you.
 
public class ListOutboundFax {
    
      public static void getListOutBoundRecords(Integer customerId ){     
        Concord__c con = new Concord__c();
        List<Concord__c> lstConcord = new  List<Concord__c>();
        
        accountmanagementreportingwebservice.AccountManagementReportingWebserviceSoap s= new accountmanagementreportingwebservice.AccountManagementReportingWebserviceSoap();
        accountmanagementreportingwebservice.ListOutboundActivityRequest  req = new accountmanagementreportingwebservice.ListOutboundActivityRequest();
        accountmanagementreportingwebservice.ListOutboundActivityResponse res = new accountmanagementreportingwebservice.ListOutboundActivityResponse();
        accountmanagementreportingwebservice.Authentication a =new accountmanagementreportingwebservice.Authentication();
        accountmanagementreportingwebservice.ArrayOfString filter = new accountmanagementreportingwebservice.ArrayOfString();
        accountmanagementreportingwebservice.Filter filters = new accountmanagementreportingwebservice.Filter();
        
                   
        a.Username = '-------';
        a.Password = '-------'; 
        req.Authentication = a;
        req.CustomerId = customerId;
        req.EndDate = date.valueOf('2019-11-12T06:03:15-08:00');
        req.ExcludeSubLevelEntries = Boolean.valueOf('true');
        req.PageIndex = 0;
        req.PageSize = 100;
        req.SortOption = 0;
        req.StartDate = date.valueOf('2019-11-11T06:03:15-08:00');
        
        res = s.ListOutboundActivity(req);
        String jsonResponse = (JSON.serializePretty(res));
    
        System.debug(jsonResponse);
   Integer count = 0;     
   JSONParser parser = JSON.createParser(jsonResponse);
          while(parser.nextToken() != null && count < lstConcord.size()){
              if(parser.getCurrentToken() == JSONToken.FIELD_NAME){
               parser.nextValue();
                if(parser.getCurrentName() == 'id') {
                   con.JOB_ID__c = parser.getText(); 
    //               System.debug(con.Name);
                }
                  
                 else if(parser.getCurrentName() == 'dur'){
                            con.Duration__c = Integer.valueOf(parser.getText());
    //                        System.debug(con.Duration__c);

                        }
                        
                        else if(parser.getCurrentName() == 'pgct'){
                            con.Delivered_Pages__c = Integer.valueOf(parser.getText());
    //                        System.debug(con.Delivered_Pages__c);
                        }
                        
                        else if(parser.getCurrentName() == 'dt'){
                            con.Stop_Date__c = Date.valueOf(parser.getText());
  //                          System.debug(con.Stop_Date__c);
                        }
                        
                        else if(parser.getCurrentName() == 'FaxNumber'){
                            con.Fax__c = parser.getText();
 //                           System.debug(con.Fax__c);
                        }  
                  
                   else if(parser.getCurrentName() == 'fcc'){
                            con.Sender_Country__c = parser.getText();
   //                         System.debug(con.Sender_Country__c);
                        } 
                  
                  else if(parser.getCurrentName() == 'cid'){
                            con.Concord_Account_ID__c = parser.getText();
    //                        System.debug(con.Concord_Account_ID__c);
                        } 
                  

                  lstConcord.add(con);
                  System.debug('Size of List' + lstConcord.size());
              }  
              
              System.debug('Size of List' + lstConcord.size());
              count++;
              
              
          }
  
                        if(lstConcord.size() > 0 ){
            try{
                
                insert lstConcord;
            }
            
            catch(Exception ex){
                System.debug(ex);
            }
        }
          
          
          
              }
          }

 
  • November 13, 2019
  • Like
  • 0
Hi everybody,

based on this article (https://metillium.com/2018/04/collapsible-section-page-layout-record-display-lightning-components/) I've tried to adapt and implement a custom page layout with collapsible sections with lightning web component.
Currently everything works fine, BUT I didn't get it to work to open and close the section with transition so that is looks really smart.

Currently the ui looks like the following:
User-added image

In comparison with the standard pagelayout there are very small differences for the layout.

The arrow looks like a fat arrow:
User-added image

Could you give me a hint how to implement a transition to that the ui looks really smoothly and how to make my custom component look like teh standard layout section?
Is there also the possibility to change the text color?

Unfortunately I have only rudimentary knowledge about CSS.

Best regards,
Christian
 
error as //Non static method cannot be referenced from a static context: System.PageReference errp.callouttest4.test1();


 Apex class:
public class callouttest4 {
    
    public map<string, object> results{get;set;}
    public list<object>animals{get;set;}
    public static string teststring{get;set;}
   public  PageReference   test1(){
       
        Http http = new Http();
        HttpRequest request = new HttpRequest();
        request.setEndpoint('https://th-apex-http-callout.herokuapp.com/animals');
        request.setMethod('GET');
 
   try {
         HttpResponse response = http.send(request);
             if (response.getStatusCode() != 200) {
                 System.debug('The status code returned was not expected: ' +
                 response.getStatusCode() + ' ' + response.getStatus());
             } else {
                System.debug(response.getStatusCode());
                 System.debug(response.getBody());
                 
                 teststring = response.getBody();
   results = (Map<String, Object>) JSON.deserializeUntyped(response.getBody());
    // Cast the values in the 'animals' key as a list
    system.debug(results);
    animals = (List<Object>) results.get('animals');
    System.debug('Received the following animals:');
                 for (Object animal: animals) {
                System.debug(animal);
                    }
          }
         }catch (Exception e) {
  System.debug(e);
       }   
     return null;    
    }
    
    
}

mockcallout:
//callouttest4mock;

@isTest
global class callouttest4mock implements HttpCalloutMock {
    // Implement this interface method
    global HTTPResponse respond(HTTPRequest req) {
        // Optionally, only send a mock response for a specific endpoint
        // and method.
        System.assertEquals('http://example.com/example/test', req.getEndpoint());
        System.assertEquals('GET', req.getMethod());
        
        // Create a fake response
        HttpResponse res = new HttpResponse();
        res.setHeader('Content-Type', 'application/json');
        res.setBody('{"example":"test"}');
        res.setStatusCode(200);
        return res;
    }
}

finalTest :
 
@isTest
public class callouttest4test {
    
    @isTest Static Void testCallout(){
        
system.Test.setMock(HttpCalloutMock.class, new callouttest4mock());
     
      callouttest4  t4 = new callouttest4();
        
         t4.test1();
        
               HttpResponse res = callouttest4.test1();

     //should to get the apex class response.. how can it acheived , thanks 
     //getting error as Non static method cannot be referenced from a static context: System.PageReference errp.callouttest4.test1()
    }

}

//Cant we use it using the pageRefernce .. !
@Future ( callout =true  ) does this method count towards API call ?   
APPLY HERE: https://www.amazon.jobs/en/jobs/700334/salesforce-com-developer

We are looking for a talented and experienced Salesforce.com developer to facilitate sales automation and enablement initiatives for our rapidly growing sales, account management, services and marketing teams. This individual will be a member of a team that is responsible for maintaining the system/data and expand on Salesforce’s integration capabilities to provide scalable and maintainable solutions on the Force.com platform. This includes development, configuration, administration of Salesforce.com and integration with other Amazon databases/systems.

BASIC QUALIFICATIONS
· Bachelor’s degree in Computer Science, Software Engineering, MIS or related field.
· Certified Salesforce Platform Developer I or equivalent experience
· 3+ years development experience with Salesforce.com (Visualforce, Apex, SOQL and SOSL)
· Proficiency in writing Visualforce, Apex classes/controllers, triggers, Salesforce.com architecture and API
· Proficiency in related tools (Data Loader, Workbench, Force.com IDE, Developer Console), cloud or on premise middleware and other enterprise integrating technologies (Informatica)
· Knowledge of integrations, third-party integration tools and ETL with Salesforce

PREFERRED QUALIFICATIONS
· Certified Salesforce Platform Developer II or equivalent experience
· 3+ years’ experience in enterprise, application and information architecture methodologies and design
· Proficiency in HTML, XML JavaScript, SQL, Java or C++, SOAP-based web services, REST services
· In depth understanding of the capabilities and constraints of the Salesforce CRM application coupled with good understanding of the business processes (Sales, Operations, Customer Success, Marketing, Partner Management, etc.)
· Demonstrative success with at least one large Salesforce.com integration project and/or two or more end-to-end Salesforce.com implementations
· Knowledge of software development patterns & best practices for the full software development life cycle, including coding standards, code reviews, source control management, build processes, testing, and operations
· Handle multiple competing priorities in a fast-paced, deadline-driven environment