I am writing a chrome addon which will get the Current selected standard or custom object by the user and displays the information about it. I have used dom fetching method but it is not reliable.
How to accomplish this by using SOQL query or rest api call?
Perform a rest call to:
https://[instance].salesforce.com/services/data/v41.0/sobjects/
This would provide all the objects there are available to the current logged in user
Related
I have created a multiselect picklist which shows the list of users on a custom object. I want to update the available values on this picklist through trigger on User object whenever there is a new user created. I do not want to update the Chosen value. Also this is a field on a lightning page, not a vf or lwc or aura component. Is it a possible requirement? Please let me know if any further information required.
Field on Lightning page
enter image description here
Dynamically updating your org's schema based on data changes is both generally a bad idea and much more difficult than it sounds.
Your trigger would have to use Asynchronous Apex, such as a Queueable class, to call the Metadata API or Tooling API to update the picklist values. To do so, it must be authenticated as an administrator, so you'd also need to set up a Named Credential and authorize it as an administrator. And then you'd have to write the moderately complex code to actually create picklist entries based on Users, decide what to do when existing Users/picklist entries are deactivated, and so on.
It is generally a better pattern to implement a custom UI component (like a Lightning Web Component) where you need to present a dynamic picklist-style interface that's driven by data.
I have used react-gtm-module to implement Universal Analytics tracking on a multi-page React application/website.
The data is coming through to Google Analytics, but the data layer is not and I'm hoping someone can help me identify why.
GTM Preview mode
I can see that when the container is loaded, all of the data layer values are set to the default value of 'Unknown'. This is what is passed through to Google Analytics.
However, when the Window is loaded, the data layer is populated with values. This is not being sent through to Google Analytics.
How do I push the data layer through to Google Analytics at the correct moment, once the data is available?
Many thanks,
Katie
Hi since you mention that you are using react-gtm-module there were different method to add data layer in your code. you need to read this https://www.npmjs.com/package/react-gtm-module#datalayer.
i have used it.
i will give you example for it.
if you want to add data layer on specific click event.
first you need to write datalayer code in you web app.like this
follow for add data in data layer
second step is to verify you data is push to your data layer or not.
for that got to your browser console and write datalayer.
then it's big data set you need to find your event name and check in there your
data is there or not.
also you need to make variables according your data.follow step 2 to do this step.
in this you need to verify it on your preview mode of GTM. after if you want to access that data in GA you need to make custom event trigger in GTM and add it in your Event tag you also need to add event parameters in event tag.
for access data in GA you can follow this video alsofollow for how to get data in GA
Note : for data layer push you have only this solution what i share. because you use that react-gtm-module.
The values are only sent to Google Analytics when there is a 'hit' to be sent. A datalayer.push (when you insert values into the datalyer) is not considered a hit, thus no data will be available.
You have some options here.
The best scenario would be to insert the values into the datalayer before the GTM is even loaded on the website. That would guarantee that all your hits would have the data available, and you would not need to delay any hits.
If that is not possible, you can also change your datalayer.push implementation to include an 'event' parameter, and then use that as a condition on the Google Analytics tag. Something like this:
dataLayer.push({
'event': 'dataLayerLoaded',
'environment': env,
'isAdminUser': isAdmin,
...
})
You can then create an event trigger that fires on the event 'dataLayerLoaded', and use this trigger on the Google Analytics Page View tag instead of the normal 'page view' one.
If you choose to follow this last route, be aware that this event will need to fire every time, otherwise no data will be sent at all. Also, if you have any custom events implemented, you may have to change their logic you use to take into consideration this new approach.
EDIT: It is also possible to change your Google Analytics Page View Trigger to "Window Loaded", but you'll need to be sure that the datalayer will always load before that, otherwise you will lose information.
Background:
I just started researching on DocuSign a couple days back and was told by DocuSign Customer Support to post questions here on SO. I am running a trial version of DocuSign to evaluate the capabilities and see if it fits our needs. We are using Classic version of Salesforce.
Business Case:
We generate hundreds of documents that need to be sent to different signatories based on certain conditions and once the signatories receive the doc, they need to select a value from a custom tag (dropdown) on the doc which will then be passed back to Salesforce.
Thanks to answers posted on SO, I know how I can dynamically add recipients to a DocuSign doc and also how I can pass values from Custom Tags back to Salesforce.
However is it possible to dynamically prepopulate documents with one or more updateable custom fields or does it have to be manually dragged and dropped onto the document each time we send the doc over?
Any pointers/references to documentation would really be appreciated.
Referencing the API documentation (below), it does look like its possible to add dynamic tabs. There is limited information on wether they can be updated, but I would suggest you try something like POSTMAN or any other REST API client that you can test this on.
Presumably, you can create this on SalesForce if you're inclined. Otherwise, you'll need to use some sever-side language to send the request.
https://developers.docusign.com/esign-rest-api/guides/features/tabs
I am very new to Salesforce Apex. I created a simple Apex-Class to get all contacts in the salesforce website.
I used javascript code to invoke that class as follows
function runApex() {
sforce.interaction.runApex('AccountRetrieval', 'getAccount', 'name=Rajeev', callback);
}
It's working fine in my laptop. But how can my customers get to access that class to get all their contacts ?
If you can't simply give them access to the contacts tab in the UI to achieve what you're after then you can create a visualforce page with a custom controller. In the controller, use SOQL to run a query for all Contacts and save the result to a list or map. You can then use this variable to pass the Contact data to the visualforce page. If you just want to dump the data to the page as HTML then you can use a list variable to hold the query result and an apex:repeat tag to generate the HTML on the visualforce page. If you want more control over how the data is displayed then you could also use the apex variable to pass the data to a javascript variable which you could then build your HTML from client-side in whatever way you like.
More detail would be needed to give you full steps on how to set this all up exactly how you want but basically you should use a visualforce page to give them an interface to run your apex code from. Access to that page can be controlled via profiles or permission sets.
If this page needs to be visible to people who do not have a user account to log into your org then you can use the Salesforce feature called Sites to expose content to them without the need for a login.
I have an app where the menu system is built dynamically using metadata fetched at startup. Based on this data, and menu selections, I need to craft a "filter box" where user can input search criteria. The "main" View consists of a filter box plus a search results panel where result(s) are rendered in accordance with their classes.
Can I model the Filter Box as a Backbone.js Model? It does not have any data fetches from the backend as its composition depends entirely on the menu selections + the metadata? E.g. when user selects "Sales" menu then the filter box might prompt for "Sales Order Number" whereas when user selects "Material" then the filter box might prompt for something else.
I would then use this widget as component of the "main" View, along with a set of results views made up on the fly. As users make their menu selections, this main View will un-render the existing filter box and recompute and re-render a new one. Other components on the screen could query the Filter Box for its settings.
The examples I have seen so far always have a url and a server fetch, save, etc. The only url-free example on the tutorial page says it is a "contrived" example. I was wondering if a backend provider is necessary and programming will be full of gotchas without conforming to this requirement.
Thanks.
You can have models without url property defined. One of the building blocks of Backbone is the Sync object, that will help you when pulling and pushing data, ideally from/to REST endpoints. For this to work you need to tell where the data are served, and to do so you set a value to url on Models or Collections.
If you don't need server comunication but you just want to use the utilities provided by simple Model or Collection (such as event handling, filtering, etc..) you just don't set url and you are good to go (just keep in mind that methods like fetch or save won't work).
Yes you can use Backbone for your DOM logic too. A model doesn't need to represent data from the server. Do whatever you like with the few basic elements of Backbone, simply use them when you feel like it'd do a great job :)