• Ryan Avent 14
  • NEWBIE
  • 10 Points
  • Member since 2021

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 2
    Likes Given
  • 18
    Questions
  • 7
    Replies

Using a SOQL query (no additonal post processing using apex) i am trying to return a unique list of products (Product2).

select Id, ProductCode from Product2 where ProductCode IN ('111123')

The issue is that ProductCode is not techunicly a unique field, and i only want to retrun one Product2 for every ProductCode in that list (only showing one as an example).

for this query i get two records

{
	"totalSize": 2,
	"done": true,
	"records": [
		{
			"attributes": {
				"type": "AggregateResult",
				"url": "/services/data/v55.0/sobjects/AggregateResult/01t03000005XVebAAG"
			},
			"ProductCode": "111123",
			"Id": "01t03000005XVebAAG"
		},
		{
			"attributes": {
				"type": "AggregateResult",
				"url": "/services/data/v55.0/sobjects/AggregateResult/01t03000005XVegAAG"
			},
			"ProductCode": "111123",
			"Id": "01t03000005XVegAAG"
		}
	]
}

 

I can get a unique list via post processing the reponse list using APEX but i want to preform this SOQL call via API and retrieve a uniqe list  without the need to do additional calls (as maximum response size is 2000) or via post processing. 

I require the SF id of one of the records (do not care which one), i have tried to use GROUP BY on ProductCode but am not seeing the result i exspect.

Is there anyway to achive what im looking for?

I have a LWC that allows users to setup our integration from within salesforce, for one of our customers this is no longer working and we are seeing the below error being passed to our redirect url as paramaters

'LOGIN_ERROR_RESTR_DOMAIN' 

authorization page must be loaded from initial domain

Log from our endpoint

Request(GET //{our redirectURL}?error=LOGIN_ERROR_RESTR_DOMAIN&error_description=authorization+page+must+be+loaded+from+initial+domainstate={{removed for security}})

LWC code to Open login 

if (this.consumerKey && this.consumerSecret && this.codeURL) {
    //opens salesforce window that will send the authorization code to the endpoint declared as 'redirect_uri'
    window.open('https://login.salesforce.com/services/oauth2/authorize?'
        + 'response_type=' + 'code' + '&'
        + 'client_id=' + this.consumerKey + '&' 
        + 'redirect_uri=' + this.codeURL + '&'
        + 'state={\"client_secret\":\"' + this.consumerSecret
        +       '\",\"client_id\":\"' + this.consumerKey
        +       '\",\"instance_url\":\"' + response.substring(14, response.length - 1)
        +       '\",\"redirect_uri\":\"' + this.codeURL + '\"}'
        , '_blank'
    );

    //enabling "Continue" button
    this.disableCont = false;
}

We retrieve the customers URL via the below apex which we use to set the state paramater (seen below) the other vairables are enterd by the user on the LWC display:

@AuraEnabled
    public static String getInstance() {
        string url = URL.getSalesforceBaseUrl().toString();
        return url;
    }

 

We are using the login.salesforce.com to open the page as specified in the Web Server Flow documentation, does this now need to be the customers org url ? e.g. https://{{customer}}.my.salesforce.com

Is anyone else haing this issue?

Hello im deploying a brand new package to our existing packaging org and am hitting a tone of errors, im following the instructions (https://developer.salesforce.com/docs/atlas.en-us.packagingGuide.meta/packagingGuide/sfdx_dev_build_man_pack_deploy.htm) but the project is failing due to 'object does not exist' or 'varible does not exist' but all these are part of the meta im trying to deploy... 

 

im running the command :

sfdx force:mdapi:deploy --deploydir "my deploydir"  --targetusername me@example.com

 

The only thing i can think of is that this package has a new namespace, can a packaging org only handle one namespace/ do i need seperate orgs (i have a devhub for the namespace). 

Im having some issues attempting to login using PartnerConnection via a simple Java project, my SF org has the below URL structure:

https://[myorg].lightning.force.com/services/Soap/u/34.0/[orgid]

(tried with multiple api versions)

when ever i run the project im seeing the below error that appreas to be triggerd during the  setting of PartnerConnection to a new connection.

Does anyone have any ideas what could be the issue here?

INFO: Error - Unexpected element. Parser was expecting element 'http://schemas.xmlsoap.org/soap/envelope/:Envelope' but found ':html'
My code:
package com.example.integration.testing;

import com.sforce.soap.partner.*;
import com.sforce.soap.partner.Error;
import com.sforce.soap.partner.fault.ApiFault;
import com.sforce.soap.partner.fault.ExceptionCode;
import com.sforce.soap.partner.fault.UnexpectedErrorFault;
import com.sforce.soap.partner.sobject.SObject;
import com.sforce.ws.ConnectionException;
import com.sforce.ws.ConnectorConfig;
import java.util.Optional;
import java.util.logging.Logger;


public class Testing {

    private static final Logger logger = Logger.getLogger(Testing.class.getName());

    public static void main(String[] args) {        
        String username = "[myUser]";
        String password = "[myUser]";
        String securityToken ="[myToken]";
        String url = "https://[my org]/services/Soap/u/42.0";
        
        //I have tried with the url ser to https://[my org]/services/Soap/u/42.0 and https://[my org]/services/Soap/u/42.0/[org id]

        PartnerConnection con = login(username, password, securityToken, url);
    }
    
    public static PartnerConnection login(String username, String password, String securityToken, String url) {
    String v_message = null;
    PartnerConnection connection = null;

    try {

      ConnectorConfig config = new ConnectorConfig();
      config.setUsername(username);
      
      if (securityToken.isBlank()) {
        password = password + securityToken;
      }
      logger.info("Setting password");

      config.setPassword(password);
	  
      logger.info("Setting setAuthEndpoint");
      String setAuthEndpoint = url;
      logger.info("Connecting to setAuthEndpoint - " + setAuthEndpoint);
      config.setAuthEndpoint(setAuthEndpoint);
   
   
      logger.info("Setting setServiceEndpoint");   
      String setServiceEndpoint = url;
      logger.info("Connecting to setServiceEndpoint - " + setServiceEndpoint);
      config.setServiceEndpoint(setServiceEndpoint);

      logger.info("Logging in as " + username);
      logger.info("Setting calling new connection");
      try{
        connection = Connector.newConnection(config);
        connection.setQueryOptions(2000);
        
         logger.info("Auth EndPoint: "+config.getAuthEndpoint());
         logger.info("Service EndPoint: "+config.getServiceEndpoint());
         logger.info("Username: "+config.getUsername());
         logger.info("SessionId: "+config.getSessionId());

      }catch(ConnectionException e){
       logger.info("Error - "+ e.getMessage());
      }
    }catch(Exception e){
        logger.info("Error during connection " + e.getMessage());
        
    }
        return connection;
    }
}

 

Dependencies:

<!-- I have tried with multiple api versions from 34 - 50 -->
        <dependencies>
            <dependency>
                <groupId>com.force.api</groupId>
                <artifactId>force-wsc</artifactId>
                <version>34.0.0</version>
            </dependency>
                <dependency>
                        <groupId>com.force.api</groupId>
                        <artifactId>force-partner-api</artifactId>
                        <version>34.0.0</version>
                        <type>jar</type>
                </dependency>
        </dependencies>

I see the below line separator used everywhere in salesforce and was wondering how i add it to my on lwc, im assuming there is a standard class or component i use and not just add it via css?

 

User-added image

Having an issue useing named credentails (custom token) in summer 23 release, since updating to summer 23 there is now an option called 'Principals' pre release 23 there was an option called 'Permission Set Mappings' that no longer seems to exist,

summer 23 >

summer_23

pre summer 23 >
pre_summer_23.png

 

The error im now seeing is that the user does not have access to the permision or it doesnt exist....

 

:11.55 (55287637)|NAMED_CREDENTIAL_RESPONSE|NamedCallout[Named Credential Id=null, Named Credential Name=null, Status Code=0, Content-Type=null, Response Size bytes=0, Overall Callout Time ms=0, Connect Time ms=0 06:55:11.0 (56222994)|EXCEPTION_THROWN|[104]|System.CalloutException: We couldn't access the credential(s). You might not have the required permissions, or the external credential "workato" might not exist.

 

Can anyone point me to how to give users permmision to the credentail / what 'Principals' are / how to use them and how they differ from the previous Permission Set Mappings ?

Im trying to dynamicly pull in a custom labbel into my vf page (the page is called in my lwc via apex). during testing i am attempting to call the vf page just passing params in the url however all i see is a blank screen (no errors in the debug log)

Neither the dynamic custom label or the test outhput are showing data, can anyone see what i am doing wrong here?

User-added image

 

VF PAGE

<apex:page showHeader="false" sidebar="false" controller="LabelTranslatorController" language="{!language}" standardStylesheets="false"  >
 <apex:outputText>{!$Label[label]}</apex:outputText>
  <apex:outputText>{!exampleText}</apex:outputText>
</apex:page>
CONTROLER
public with sharing class LabelTranslatorController {

    public String language { get; set; }
    public String label { get; set; }
    public String exampleText { get; set; }

        
    public LabelTranslatorController() {
            Map<String, String> reqParams = ApexPages.currentPage().getParameters();
            language = reqParams.get(language);
            label = reqParams.get(label);
            exampleText = reqParams.get(exampleText);

    }
}

 

Example VF page URL

https://[SF org]/apex/Custom_Label_Translator?language=en_US&label=Process_Object_Create_Error&exampleText=this is an example
 


APEX

@AuraEnabled(cacheable=false)
    global static string getLabelTranslator(String label) {

        try {

            PageReference r = Page.Custom_Label_Translator;// the vf page
            r.getParameters().put('language',  UserInfo.getLocale());
            r.getParameters().put('label', label);
            r.getParameters().put('exampleText', 'this is an exampple');


            string resp = r.getContent().toString();
            
            return r.getContent().toString();
        } catch(Exception e){
            system.debug('Error - ' +  e.getMessage());
            system.debug('Error - ' +  e.getCause());

            return label;
        }  
    }

I have a custom event that is dispatched from my clild LWC 

Event dispached from child:

spinner(boolean){
    console.log('set spinner - ' + boolean);
    const spinner = new CustomEvent('spinnernotification', {
      display: boolean
    });
    this.dispatchEvent(spinner);  
  }

The event is being retrieved by the parent LWC but i am unable to read the display property, and am getting an undefined.

Console lines:

set spinner - false
called with display value undefined

Parent LWC:

displaySpinner(customEvent){
	
	if(null != customEvent){
		console.log('called with display value ' + customEvent.display);
		this.spinner = customEvent.display;
	}else{
		console.log('customEvent display is null');
		this.spinner = false;
	}
}

if i stringify the customEvent in the parent all i see is the below:

value {"isTrusted":false,"composed":false}

Im hoping somone can point me in the right direction, im using an slds-grid class and in that displaying an accordion and a checkbox, the issue im having is that the checbox is always much higher then the accordion making the ui look rubbish (see below)

checkbox and accordion

im tying to make the checkbox and accordion line up, doe anyone know i can do this?

User-added image

<template>
    <div class="slds-grid">
        <div>
            <lightning-input 
            class="slds-col slds-size_1-of-2" 
            type="checkbox"
            onchange={handleChange} checked={checkboxCheck} padding="around-xxx-small" ></lightning-input>
        </div>
        <div class="slds-col">
            <lightning-accordion-section  class="slds-form-element_compound" name={cpqId} label={label}>
                <div class="slds-grid slds-form__row slds-wrap">
                    <lightning-input padding="around-xxx-small" class="slds-col slds-size_1-of-2" type="text" label="Example1" disabled>Example 1</lightning-input>
                    <lightning-input padding="around-xxx-small" class="slds-col slds-size_1-of-2" type="text" label="Example2" disabled>Example 2</lightning-input>
                    <lightning-input padding="around-xxx-small" class="slds-col slds-size_1-of-2" type="text" label="Example3" disabled>Example 3</lightning-input>
                    <lightning-input padding="around-xxx-small" class="slds-col slds-size_1-of-2" type="text" label="Example4" disabled>Example 4</lightning-input>
                    <lightning-input padding="around-xxx-small" class="slds-col slds-size_1-of-2" type="text" label="Example5" disabled>Example 5</lightning-input>
        
                </div>
        </lightning-accordion-section>
        </div>
    </div>
</template>

Im trying to create an apex method where i can pass in a string and check to see if there is a custom label with that name / return its value. 

i have searched online and people are suggesting the below but these methods dont seem to work in the latest release via apex.

 

Method 1

public String getLabelString(String labelName ){
        Component.Apex.OutputText output = new Component.Apex.OutputText();
        output.expressions.value = '{!$Label.' + labelName + '}';
        
        return String.valueOf(output.value);
    }

 

Method 2

public static String getCustomLabel(String label){
        String labelTxt;

        labelTxt = System.Label.getLabel(label);

       
        return labelTxt;

    }

Im having an issue calling a apex function from my LWC and am hitting a '[e is not a function]' component exception error, resulting in tmy method never being run...

 

I can see from the logging in the saveConnectionFields function that this.fieldData contains a json string, but the apex method never gets called.

e.g. 

saleFields - [{"Id":"a0253000002npEFAAY","Code":"RCPQI-OM","Name":"Opportunity","Value":"Quote"},{"Id":"a0253000002npEGAAY","Code":"RCPQI-OM","Name":"OpportunityMultiSelect","Value":false},{"Id":"a0253000002npEHAAY","Code":"RCPQI-OM","Name":"Quote","Value":"None"},{"Id":"a0253000002npEIAAY","Code":"RCPQI-OM","Name":"QuoteMultiSelect","Value":false},{"Id":"a0253000002npEJAAY","Code":"RCPQI-OM","Name":"Lead","Value":"None"},{"Id":"a0253000002npEKAAY","Code":"RCPQI-OM","Name":"LeadMultiSelect","Value":false},{"Id":"a0253000002npELAAY","Code":"RCPQI","Name":"OpportunitySearch","Value":true},{"Id":"a0253000002npEMAAY","Code":"RCPQI","Name":"QuoteSearch","Value":false},{"Id":"a0253000002npENAAY","Code":"RCPQI","Name":"LeadSearch","Value":false},{"Id":"a0253000002npEOAAY","Code":"RCPQI","Name":"SearchPath","Value":"search"},{"Id":"a0253000002npEPAAY","Code":"RCPQI","Name":"Theme","Value":"Salesforce"},{"Id":"a0253000002npEQAAY","Code":"PMG","Name":"EnableProductMapping","Value":true},{"Id":"a0253000002npERAAY","Code":"RCPQ-QMI","Name":"UpdateQuoteOnEdit","Value":true},{"Id":"a0253000002npESAAY","Code":"RCPQ-QMI","Name":"DefaultQuotePriceBook","Value":""},{"Id":"a0253000002npETAAY","Code":"RCPQ-QMO","Name":"LastBuildQuotePrimary","Value":true},{"Id":"a0253000002npEUAAY","Code":"RCPQ-QMO","Name":"IntegrateQuoteProducts","Value":true}]

import { LightningElement, track, api, wire } from 'lwc';
import { getRecord } from 'lightning/uiRecordApi';
import {ShowToastEvent} from 'lightning/platformShowToastEvent';
import saveFields from '@salesforce/apex/ConnectionOperationsController.saveFields';

export default class ConnectionFields extends LightningElement {

    @api recordId;

    @track
    Fields =[];
	
    @track
    fieldData ='';
	
	@wire(getSectionMap, {connectionId: '$recordId'})
    wiredRecord({ error, data }) {
        if (error) { 
            console.log('Error occured loading fields');

        } else if (data) {
            let response = JSON.parse(data);
			this.Fields = response.Fields;
        }
    }
	
	saveConnectionFields(){
		console.log('Saving fields for  - ' + this.recordId);
		console.log('Construct field map');
		
		this.fieldData = null;
		
		let saveFields =[]
		this.Fields.forEach((f) =>{
				let field = {};
				field.Id = f.Id;
				field.Code = sec.Code;
				field.Name = f.Name;
				field.Value = f.Value;
				saveFields.push(field);
			})

		console.log('saveFields length ['+ saveFields.length +']');


		this.fieldData = JSON.stringify(saveFields);
		
		console.log('saleFields - '+  this.fieldData);
		
		console.log('calling saleFields');

		saveFields({connectionId: this.recordId, fieldData: this.fieldData})
			.then((result) => {
				let resp = result;
				console.log(' result - ' + JSON.stringify(resp));

			})
			.catch((error) => {
				this.error = error;
				console.log(' error - ' + JSON.stringify(error));
			});
	}
}
 
@AuraEnabled(cacheable=false)
public static string saveFields(string connectionId, String fieldData){
	system.debug('method called');

	return 'method run';

}

Im trying to replicate a API-TOKEN auth method that i have in a PostMan project, i have followed the documentation but am always receving a 401 unauthorized error in the response.

Document i followed: (https://help.salesforce.com/s/articleView?id=sf.nc_custom_headers_and_api_keys.htm&type=5)

 

Can anyone see anyting i have set up incorrectly?

 

PostMan:

PostManNamed Credential: 

NamedCred

User-added image

Log:

05:41:29.0 (36297208)|CALLOUT_REQUEST|[104]|System.HttpRequest[Endpoint=callout:workatoDev/connectionOptions, Method=POST]
05:41:29.72 (72227578)|NAMED_CREDENTIAL_REQUEST|NamedCallout[Named Credential Id=0XA530000004Gbb, Named Credential Name=workatoDev, Endpoint=https://{removed for security reasons}/connectionOptions, Method=POST, External Credential Type=EXTERNAL, HTTP Header Authorization=Method: Not set - Credential: Not set, Content-Type=application/json, Request Size bytes=37, Retry on 401=True]
05:41:29.73 (73319470)|NAMED_CREDENTIAL_RESPONSE|NamedCallout[Named Credential Id=0XA530000004Gbb, Named Credential Name=workatoDev, Status Code=401, Content-Type=application/json, Response Size bytes=57, Overall Callout Time ms=21, Connect Time ms=1
05:41:29.0 (73987326)|CALLOUT_RESPONSE|[104]|System.HttpResponse[Status=Unauthorized, StatusCode=401]

Im using an itteration to construct a dynamic settings page for an integration im building on, i am displaying inputs from a fields custom object that retrieved via wired apex call.

Is it possible to call a js function with paramater to retrieve the options list for the itterated field?

Is it possible to pass a paramaters to the onchange function?

I can see that the event.detail will give me the value of the field but i want the custom params i set and event doent seem to contain thoese.

 

<template for:each={sec.Fields} for:item="field">

	<!-- this input is only displayed if its text-->
	<template if:true={field.IsText}>
		<lightning-input 
		key={field.Id} 
		class="slds-p-around_xxx-small" 
		inputid={field.Id} 
		type="text" 
		label={field.Label} 
		field-level-help={field.Description}></lightning-input>
	</template>

	<!-- this input is only displayed if its select -->
	<template if:true={field.IsText}>
		<lightning-combobox
		key={field.Id}
		class="slds-p-around_xxx-small"
		inputid={field.Id}
		name={field.Name}
		label={field.Label}
		value={field.Value}
		placeholder="Select Value"
		options={options}
		onchange={handleChange}></lightning-combobox>
	</template>

</template>

I'm creating a LWC to display custom data (related to another custom object) in a custom layout but I'm not seeing the result I expect when retrieving data via @wire apex method.

when calling my apex I can see that the list has data from the debug logs, but how do I access this in an LWC component?

from the console I see the below for my comment lines:
Example - ExampleConnectionFields: loading fields - [object Object]
Example - ExampleConnectionFields: records retrieved - [object Object]
Example - ExampleConnectionFields: records retrieved - undefined
Example - ExampleConnectionFields: json - {}
 

LWC .js

import { LightningElement, track, api, wire } from 'lwc';
import { getRecord } from 'lightning/uiRecordApi';
import getConnectionFields from '@salesforce/apex/CustomRecordSelector.getConnectionFields';

export default class ExampleConnectionFields extends LightningElement {
    @api recordId;
   
    @track
    connection

    @track
    connectionFields

    @track 
    sections;


    //pass the recordId the LWS is on to getConnectionFields method to see if there is any data to display 
    @wire(getConnectionFields, {connectionId: '$recordId'}) connectionFields;

    get hasResults() {
        if(this.connectionFields && this.connectionFields.data) {
            return (this.connectionFields.data.length > 0)
         }
           return false;
    }

	connectedCallback() {
		this.loadFields();
	}

	loadFields() {
        console.log('Example - ExampleConnectionFields: loading fields - '+ this.connectionFields );
        console.log('Example - ExampleConnectionFields: records retrieved - '+ this.connectionFields );
        console.log('Example - ExampleConnectionFields: records retrieved - '+ this.connectionFields.data);
        console.log('Example - ExampleConnectionFields: json - '+ JSON.stringify(this.connectionFields));

  	}
}


Apex

 

@AuraEnabled(cacheable=true)
    public static list<Rev_CPQ_Connection_Fields__c> getConnectionFields(string connectionId){
        system.debug('Example - CustomRecordSelector.getConnectionFields: method called.');
        list<Connection_Fields__c> fields = new List<Connection_Fields__c>();

        fields = [select id, Name where Example__Connection_Id__c =: connectionId];
        
        system.debug('Example - CustomRecordSelector.getConnectionFields: return [' + fields.size() +'] fields for connection.');
        return fields;
    }

I have a managed package installed in a nuber of environments, some of these enviroments are suddenly (package has been installed for months) hitting an error when edditing an opportunity (object that has the component) 

im seeing the below error code: 

Error ID: 109213136-82551 (-1540990655)

Unfortunatly i can not find any infomation about it and no errors are showing in the debug logs, When looking at the page via the Lightning app builder i see the error "we could not display {Name of aura compnent)" i can also see that there are no Aura compnents from my pachkage listed in the custom - managed section.

 

Any ideas how i can get some infomation on the error / what could be the cause?

Hello im haveing an issue with SFDX in a newly created scratch org (tried the same process in multiple).

I currently have two 'Autolaunched Flow' which i have used the 'Save as' option to create copies of, these have then changed to 'Record-Triggerd Flow' when compleeting the flow and setting it as active i am able to retrieve the new flow using the command:

  • sfdx force:source:pull

Note: The new flows lables end with Trigger, and i have renamed the old ones ending with (deprecated) ...

new flows

However when i push the source to a diffrent scratch org (new org) i dont see the Record-Triggerd Flow section populated, and when looking at the flow i can see its an automated process, i also dont see (deprecated) suffix on the older flows...

wrong data
I have also tried using the command below and am seeing the same result

  • sfdx force:source:retrieve -m flow

SFDX Version: sfdx-cli/7.180.0 win32-x64 node-v18.12.1

SFDX Project sourceApiVersion:45.0

Anyone got any ideas why im get getting to correct data pulled down?

I have created a new scratch org today and attempted to push my project source out so that i could start work on a new task, when preforming a sfdx force:source:push to the org i have hit with the below error:

=== Component Failures [2]

 Type  Name           Problem
 ───── ────────────── ──────────────────────────────────────────────────────────────────────────────
 Error c1QuoteLineLwc duplicate value found: <unknown> duplicates value on record with id: <unknown>
 Error c1QuoteLineLwc duplicate value found: <unknown> duplicates value on record with id: <unknown>
 



I was able to work on this project a coumple of months ago (new scratch org) with no issues, looking at the c1QuoteLineLwc this has not been changes in over three years, and there is only one LWC with this name.


I have also tried to push to a new org the same branch i worked on a few months ago and am seeing the same issue, can anyone shed some light on the problem?


looking at the deployment logs in the scratch org all i see is:


 

API NameTypeLineColumnError Messagec1QuoteLineLwcLightning Web Component Bundle00duplicate value found: <unknown> duplicates value on record with id: <unknown>
c1QuoteLineLwcLightning Web Component Bundle00duplicate value found: <unknown> duplicates value on record with id: <unknown>

I have a public with sharing class that contains a method to delete a record in a custom object, when this method is triggerd by a user who has delete permisoins to the custom object i still recieve the error 

 First exception on row 0 with id a030U000004NxLCQA0; first error: INSUFFICIENT_ACCESS_OR_READONLY, insufficient access rights on object id: []

I have checked the users permissions to the object and the have the following:

Read, Create, Edit, Delete
 

If i add the permisions View all, Modify all then they are able to delete the object.....

Any idea why this is causing an issue?

I have a LWC that allows users to setup our integration from within salesforce, for one of our customers this is no longer working and we are seeing the below error being passed to our redirect url as paramaters

'LOGIN_ERROR_RESTR_DOMAIN' 

authorization page must be loaded from initial domain

Log from our endpoint

Request(GET //{our redirectURL}?error=LOGIN_ERROR_RESTR_DOMAIN&error_description=authorization+page+must+be+loaded+from+initial+domainstate={{removed for security}})

LWC code to Open login 

if (this.consumerKey && this.consumerSecret && this.codeURL) {
    //opens salesforce window that will send the authorization code to the endpoint declared as 'redirect_uri'
    window.open('https://login.salesforce.com/services/oauth2/authorize?'
        + 'response_type=' + 'code' + '&'
        + 'client_id=' + this.consumerKey + '&' 
        + 'redirect_uri=' + this.codeURL + '&'
        + 'state={\"client_secret\":\"' + this.consumerSecret
        +       '\",\"client_id\":\"' + this.consumerKey
        +       '\",\"instance_url\":\"' + response.substring(14, response.length - 1)
        +       '\",\"redirect_uri\":\"' + this.codeURL + '\"}'
        , '_blank'
    );

    //enabling "Continue" button
    this.disableCont = false;
}

We retrieve the customers URL via the below apex which we use to set the state paramater (seen below) the other vairables are enterd by the user on the LWC display:

@AuraEnabled
    public static String getInstance() {
        string url = URL.getSalesforceBaseUrl().toString();
        return url;
    }

 

We are using the login.salesforce.com to open the page as specified in the Web Server Flow documentation, does this now need to be the customers org url ? e.g. https://{{customer}}.my.salesforce.com

Is anyone else haing this issue?

Im having some issues attempting to login using PartnerConnection via a simple Java project, my SF org has the below URL structure:

https://[myorg].lightning.force.com/services/Soap/u/34.0/[orgid]

(tried with multiple api versions)

when ever i run the project im seeing the below error that appreas to be triggerd during the  setting of PartnerConnection to a new connection.

Does anyone have any ideas what could be the issue here?

INFO: Error - Unexpected element. Parser was expecting element 'http://schemas.xmlsoap.org/soap/envelope/:Envelope' but found ':html'
My code:
package com.example.integration.testing;

import com.sforce.soap.partner.*;
import com.sforce.soap.partner.Error;
import com.sforce.soap.partner.fault.ApiFault;
import com.sforce.soap.partner.fault.ExceptionCode;
import com.sforce.soap.partner.fault.UnexpectedErrorFault;
import com.sforce.soap.partner.sobject.SObject;
import com.sforce.ws.ConnectionException;
import com.sforce.ws.ConnectorConfig;
import java.util.Optional;
import java.util.logging.Logger;


public class Testing {

    private static final Logger logger = Logger.getLogger(Testing.class.getName());

    public static void main(String[] args) {        
        String username = "[myUser]";
        String password = "[myUser]";
        String securityToken ="[myToken]";
        String url = "https://[my org]/services/Soap/u/42.0";
        
        //I have tried with the url ser to https://[my org]/services/Soap/u/42.0 and https://[my org]/services/Soap/u/42.0/[org id]

        PartnerConnection con = login(username, password, securityToken, url);
    }
    
    public static PartnerConnection login(String username, String password, String securityToken, String url) {
    String v_message = null;
    PartnerConnection connection = null;

    try {

      ConnectorConfig config = new ConnectorConfig();
      config.setUsername(username);
      
      if (securityToken.isBlank()) {
        password = password + securityToken;
      }
      logger.info("Setting password");

      config.setPassword(password);
	  
      logger.info("Setting setAuthEndpoint");
      String setAuthEndpoint = url;
      logger.info("Connecting to setAuthEndpoint - " + setAuthEndpoint);
      config.setAuthEndpoint(setAuthEndpoint);
   
   
      logger.info("Setting setServiceEndpoint");   
      String setServiceEndpoint = url;
      logger.info("Connecting to setServiceEndpoint - " + setServiceEndpoint);
      config.setServiceEndpoint(setServiceEndpoint);

      logger.info("Logging in as " + username);
      logger.info("Setting calling new connection");
      try{
        connection = Connector.newConnection(config);
        connection.setQueryOptions(2000);
        
         logger.info("Auth EndPoint: "+config.getAuthEndpoint());
         logger.info("Service EndPoint: "+config.getServiceEndpoint());
         logger.info("Username: "+config.getUsername());
         logger.info("SessionId: "+config.getSessionId());

      }catch(ConnectionException e){
       logger.info("Error - "+ e.getMessage());
      }
    }catch(Exception e){
        logger.info("Error during connection " + e.getMessage());
        
    }
        return connection;
    }
}

 

Dependencies:

<!-- I have tried with multiple api versions from 34 - 50 -->
        <dependencies>
            <dependency>
                <groupId>com.force.api</groupId>
                <artifactId>force-wsc</artifactId>
                <version>34.0.0</version>
            </dependency>
                <dependency>
                        <groupId>com.force.api</groupId>
                        <artifactId>force-partner-api</artifactId>
                        <version>34.0.0</version>
                        <type>jar</type>
                </dependency>
        </dependencies>

Having an issue useing named credentails (custom token) in summer 23 release, since updating to summer 23 there is now an option called 'Principals' pre release 23 there was an option called 'Permission Set Mappings' that no longer seems to exist,

summer 23 >

summer_23

pre summer 23 >
pre_summer_23.png

 

The error im now seeing is that the user does not have access to the permision or it doesnt exist....

 

:11.55 (55287637)|NAMED_CREDENTIAL_RESPONSE|NamedCallout[Named Credential Id=null, Named Credential Name=null, Status Code=0, Content-Type=null, Response Size bytes=0, Overall Callout Time ms=0, Connect Time ms=0 06:55:11.0 (56222994)|EXCEPTION_THROWN|[104]|System.CalloutException: We couldn't access the credential(s). You might not have the required permissions, or the external credential "workato" might not exist.

 

Can anyone point me to how to give users permmision to the credentail / what 'Principals' are / how to use them and how they differ from the previous Permission Set Mappings ?

Im having an issue calling a apex function from my LWC and am hitting a '[e is not a function]' component exception error, resulting in tmy method never being run...

 

I can see from the logging in the saveConnectionFields function that this.fieldData contains a json string, but the apex method never gets called.

e.g. 

saleFields - [{"Id":"a0253000002npEFAAY","Code":"RCPQI-OM","Name":"Opportunity","Value":"Quote"},{"Id":"a0253000002npEGAAY","Code":"RCPQI-OM","Name":"OpportunityMultiSelect","Value":false},{"Id":"a0253000002npEHAAY","Code":"RCPQI-OM","Name":"Quote","Value":"None"},{"Id":"a0253000002npEIAAY","Code":"RCPQI-OM","Name":"QuoteMultiSelect","Value":false},{"Id":"a0253000002npEJAAY","Code":"RCPQI-OM","Name":"Lead","Value":"None"},{"Id":"a0253000002npEKAAY","Code":"RCPQI-OM","Name":"LeadMultiSelect","Value":false},{"Id":"a0253000002npELAAY","Code":"RCPQI","Name":"OpportunitySearch","Value":true},{"Id":"a0253000002npEMAAY","Code":"RCPQI","Name":"QuoteSearch","Value":false},{"Id":"a0253000002npENAAY","Code":"RCPQI","Name":"LeadSearch","Value":false},{"Id":"a0253000002npEOAAY","Code":"RCPQI","Name":"SearchPath","Value":"search"},{"Id":"a0253000002npEPAAY","Code":"RCPQI","Name":"Theme","Value":"Salesforce"},{"Id":"a0253000002npEQAAY","Code":"PMG","Name":"EnableProductMapping","Value":true},{"Id":"a0253000002npERAAY","Code":"RCPQ-QMI","Name":"UpdateQuoteOnEdit","Value":true},{"Id":"a0253000002npESAAY","Code":"RCPQ-QMI","Name":"DefaultQuotePriceBook","Value":""},{"Id":"a0253000002npETAAY","Code":"RCPQ-QMO","Name":"LastBuildQuotePrimary","Value":true},{"Id":"a0253000002npEUAAY","Code":"RCPQ-QMO","Name":"IntegrateQuoteProducts","Value":true}]

import { LightningElement, track, api, wire } from 'lwc';
import { getRecord } from 'lightning/uiRecordApi';
import {ShowToastEvent} from 'lightning/platformShowToastEvent';
import saveFields from '@salesforce/apex/ConnectionOperationsController.saveFields';

export default class ConnectionFields extends LightningElement {

    @api recordId;

    @track
    Fields =[];
	
    @track
    fieldData ='';
	
	@wire(getSectionMap, {connectionId: '$recordId'})
    wiredRecord({ error, data }) {
        if (error) { 
            console.log('Error occured loading fields');

        } else if (data) {
            let response = JSON.parse(data);
			this.Fields = response.Fields;
        }
    }
	
	saveConnectionFields(){
		console.log('Saving fields for  - ' + this.recordId);
		console.log('Construct field map');
		
		this.fieldData = null;
		
		let saveFields =[]
		this.Fields.forEach((f) =>{
				let field = {};
				field.Id = f.Id;
				field.Code = sec.Code;
				field.Name = f.Name;
				field.Value = f.Value;
				saveFields.push(field);
			})

		console.log('saveFields length ['+ saveFields.length +']');


		this.fieldData = JSON.stringify(saveFields);
		
		console.log('saleFields - '+  this.fieldData);
		
		console.log('calling saleFields');

		saveFields({connectionId: this.recordId, fieldData: this.fieldData})
			.then((result) => {
				let resp = result;
				console.log(' result - ' + JSON.stringify(resp));

			})
			.catch((error) => {
				this.error = error;
				console.log(' error - ' + JSON.stringify(error));
			});
	}
}
 
@AuraEnabled(cacheable=false)
public static string saveFields(string connectionId, String fieldData){
	system.debug('method called');

	return 'method run';

}

I have a managed package installed in a nuber of environments, some of these enviroments are suddenly (package has been installed for months) hitting an error when edditing an opportunity (object that has the component) 

im seeing the below error code: 

Error ID: 109213136-82551 (-1540990655)

Unfortunatly i can not find any infomation about it and no errors are showing in the debug logs, When looking at the page via the Lightning app builder i see the error "we could not display {Name of aura compnent)" i can also see that there are no Aura compnents from my pachkage listed in the custom - managed section.

 

Any ideas how i can get some infomation on the error / what could be the cause?

I have created a new scratch org today and attempted to push my project source out so that i could start work on a new task, when preforming a sfdx force:source:push to the org i have hit with the below error:

=== Component Failures [2]

 Type  Name           Problem
 ───── ────────────── ──────────────────────────────────────────────────────────────────────────────
 Error c1QuoteLineLwc duplicate value found: <unknown> duplicates value on record with id: <unknown>
 Error c1QuoteLineLwc duplicate value found: <unknown> duplicates value on record with id: <unknown>
 



I was able to work on this project a coumple of months ago (new scratch org) with no issues, looking at the c1QuoteLineLwc this has not been changes in over three years, and there is only one LWC with this name.


I have also tried to push to a new org the same branch i worked on a few months ago and am seeing the same issue, can anyone shed some light on the problem?


looking at the deployment logs in the scratch org all i see is:


 

API NameTypeLineColumnError Messagec1QuoteLineLwcLightning Web Component Bundle00duplicate value found: <unknown> duplicates value on record with id: <unknown>
c1QuoteLineLwcLightning Web Component Bundle00duplicate value found: <unknown> duplicates value on record with id: <unknown>
Hi,

We used to be able to do this in Aura:
String labelName = 'mylabel';
$A.getReference("$Label.c."+ labelName);



$A is not accessible in LWC

Following the documentation I can only see a way to get access to Label's value through import.
As far as I know import don't work dynamically. You can only write an import if you know the name of the label.

I was hoping for a solution involving Apex and/or SOQL but could not find anything.

Any idea?
 
I have created a flow where if the product field Product type changed then update the event check box on opp.
I created a record trigger flow if the product field Product type changed then update a check box on opp. This is working but not always, most of the time there is no update, and there is no pattern to pinpoint the issue to.

 The trigger is when the Product's product type(text field) is changed.
 User-added image
 
next, I use the get record element to get the opp line item as this object is on Opp related list and has a Product attached to it.
 User-added image
the decision is used next to check if the Product type(text field) contain "Delivery Fee" 
 User-added image
if yes then Get opp and check the check box(image below) if not uncheck it.
 User-added image
 
this is the object Opp Product(OppLineItem) which I am using to get to the right Opp from the product. As this has a Product lookup field.
User-added image
 
 
I am unable to understand where I am going wrong, I don't have any Failed Interviews and there is no error in the debug log too. Please help!
Thanks in advance!
  • October 20, 2022
  • Like
  • 2
I have retrieved metadata from my Sandbox using the project manifest, but am unable to deploy any custom field changes. I receive the following error when running "Deploy source to org":
An error was encountered during conflict detection. MetadataTransferError: Metadata API request failed: Component conversion failed: Method not implemented

Deploys work without issue using the CLI directly.