Skip to content

Commit

Permalink
Add clientId header param to identify the extension in EventLogFile f… (
Browse files Browse the repository at this point in the history
#648)

## Describe your changes
Add
[clientId](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/headers_calloptions.htm)
header param to identify the extension in EventLogFile [feature
504](#504)
## Issue ticket number and link
#504 
## Checklist before requesting a review
- [ ] I have read and understand the [Contributions
section](https://github.com/tprouvot/Salesforce-Inspector-reloaded#contributions)
- [ ] Target branch is releaseCandidate and not master
- [ ] I have performed a self-review of my code
- [ ] I ran the [unit
tests](https://github.com/tprouvot/Salesforce-Inspector-reloaded#unit-tests)
and my PR does not break any tests
- [ ] I documented the changes I've made on the
[CHANGES.md](https://github.com/tprouvot/Salesforce-Inspector-reloaded/blob/master/CHANGES.md)
and followed actual conventions
- [ ] I added a new section on
[how-to.md](https://github.com/tprouvot/Salesforce-Inspector-reloaded/blob/master/docs/how-to.md)
(optional)
  • Loading branch information
tprouvot authored Nov 15, 2024
1 parent 451fe60 commit 3169037
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Version 1.26

- Add [clientId](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/headers_calloptions.htm) header param to identify the extension in EventLogFile [feature 504](https://github.com/tprouvot/Salesforce-Inspector-reloaded/issues/504)
- Add Apex Classes metadata search in Shortcut tab and new option configuration for the search [feature 591](https://github.com/tprouvot/Salesforce-Inspector-reloaded/issues/591) request by [mpekacki](https://github.com/mpekacki)
- Add `My Personal Information` shortcuts [feature 627](https://github.com/tprouvot/Salesforce-Inspector-reloaded/issues/627) request by [Alfredo Chissotti](https://github.com/Astisme)
- Add compatibility for force.com domain for Sf internal orgs
Expand Down
3 changes: 3 additions & 0 deletions addon/inspector.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export function nullToEmptyString(value) {
// For react input fields, the value may not be null or undefined, so this will clean the value
return (value == null) ? "" : value;
}
const clientId = "Salesforce Inspector Reloaded";

export let sfConn = {

Expand Down Expand Up @@ -54,6 +55,7 @@ export let sfConn = {
xhr.open(method, sfHost + url, true);

xhr.setRequestHeader("Accept", "application/json; charset=UTF-8");
xhr.setRequestHeader("Sforce-Call-Options", `client:${clientId}`);

if (api == "bulk") {
xhr.setRequestHeader("X-SFDC-Session", this.sessionId);
Expand Down Expand Up @@ -177,6 +179,7 @@ export let sfConn = {
xhr.open("POST", "https://" + this.instanceHostname + wsdl.servicePortAddress + "?cache=" + Math.random(), true);
xhr.setRequestHeader("Content-Type", "text/xml");
xhr.setRequestHeader("SOAPAction", '""');
xhr.setRequestHeader("CallOptions", `client:${clientId}`);

let sessionHeaderKey = wsdl.apiName == "Metadata" ? "met:SessionHeader" : "SessionHeader";
let sessionIdKey = wsdl.apiName == "Metadata" ? "met:sessionId" : "sessionId";
Expand Down

0 comments on commit 3169037

Please sign in to comment.