Convert String into Blob and Blob into String using Apex in Salesforce
Apex Code Snippet to Convert Blob into String Apex Code Snippet to Convert String into Blob
Apex Code Snippet to Convert Blob into String Apex Code Snippet to Convert String into Blob
We get this requirement while coding several time to convert epoch time (Unix time) to Datetime. First thing, never store a epoch time in Integer and use Long always. Below given code can be used to convert into datetime: To get the epoch from a datetime variable you can just call the getTime() instance method:
Feel free to utilize this method and change as per your need:
It’s very usual to fall in such a requirement to execute apex scheduled job every 1 hour. The dirtiest way to schedule it 24 times at a specific time. But there is another very efficient way to run it each clock hour and can be achieved by just running it once using power of cron …
DESCRIPTION Tracing IP address of community is utmost requirement to achieve different goals like geo based technical support, spam protection and other security things. There are bunch of forum discussions related to this: https://developer.salesforce.com/forums/?id=9062I000000g56rQAA https://salesforce.stackexchange.com/questions/145145/how-to-get-ip-address-of-current-user-in-lightning-component https://salesforce.stackexchange.com/questions/246085/how-to-get-the-public-ip-address-of-current-user-in-lightning-component-hosted-o/246087 APPROACHES In order to solve this, simple approach is to get the IP address and store in any custom …
How to get IP Address of Community User – Guest and Logged in Customer User Read More »
This articles explains how can we authenticate in Box.com using JWT OAuth 2.0. Here is the API details in Box API documentation: https://developer.box.com/guides/authentication/jwt/without-sdk/ Box – Prerequisites Salesforce – Prerequisites Apex Code A). In following implementation, we are not using standard JWT and JWS because it throws error “Signature verification error. The public key identified by …
Box Authentication – Getting Access token Using JWT OAuth2.0 in Salesforce Read More »
Add Community Member Salesforce stores community membership in object called NetworkMemberGroup. Although Salesforce says ‘create’ allowed on Network Member but seems that not allowed using apex code. No worries, we can make a post REST call for the same: First add your salesforce base url as remote site setting then add this code as part …
Target Record: A Case record with Status =”New” in Database. There is trigger which updates the value of Status =”Working” in before update event. There is workflow too which updates to Status to “Escalated”. So, we are going to analyze how system behaves in these scenarios: Lets play as below: P.S: In all events, old …
Execution of Trigger and Workflow – A practical Analysis Read More »
The AuthSession object keeps each non-guest user session in your organization. Here is full detail of object: https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_authsession.htm Check the size of auth if it’s greater than zero and IsCurrent is true then session is active otherwise not.
It’s very typical to run batch jobs using scheduled job in each org. I’ve seen developers to develop different scheduled job for each batch class which cost not only extra redundant code but also lot of overhead of complexity and test code liability. So, I just developed a way to use a single scheduled jobs …
Use a single scheduled job to run multiple batch class dynamically Read More »