Skip to content

Instantly share code, notes, and snippets.

View amitastreait's full-sized avatar
🎯
Creativity ki potli liye chala ja raha ek bairagi

Amit Singh amitastreait

🎯
Creativity ki potli liye chala ja raha ek bairagi
View GitHub Profile
@amitastreait
amitastreait / DefaultOmniScriptEditBlock.java
Created November 7, 2025 04:11
DefaultOmniScriptEditBlock.java
global class DefaultOmniScriptEditBlock implements Callable {
global Object call(String action, Map<String, Object> args) {
Map<String, Object> input = (Map<String, Object>)args.get('input');
Map<String, Object> output = (Map<String, Object>)args.get('output');
Map<String, Object> options = (Map<String, Object>)args.get('options');
return invokeMethod(action, input, output, options);
}
global Object invokeMethod(String methodName, Map<String,Object> input, Map<String,Object> output, Map<String,Object> option){
global with sharing class MySelectionOptions implements Callable {
global Object call(String methodName, Map<String, Object> args) {
// input
// output
// options
Map<String, Object> input = (Map<String, Object>)args.get('input');
Map<String, Object> output = (Map<String, Object>)args.get('output');
Map<String, Object> options = (Map<String, Object>)args.get('options');
// output.put('message','Welcome to OmniScript!');
@amitastreait
amitastreait / Salesforce_DX_MCP.json
Created October 18, 2025 12:03
Salesforce DX MCP Servers & Tools
{
"servers": {
"Salesforce DX": {
"type": "stdio",
"command": "npx",
"args": [
"-y", "@salesforce/mcp@latest",
"--orgs", "DEFAULT_TARGET_ORG",
"--toolsets", "all",
"--allow-non-ga-tools"
name: Build and Deploy to Sandbox in Cloudhub
on:
push:
branches:
- feature/*
- developer
paths:
- 'src/**'
pull_request:
/**
* Method to retrieve records created within the last hour
* @param objectName The API name of the Salesforce object to query
* @return List of sObjects created in the last hour
*/
public static List<SObject> getLastHourRecords(String objectName) {
// Calculate the time one hour ago
DateTime oneHourAgo = DateTime.now().addHours(-1);
// Build the dynamic SOQL query
Your name is {!$Input:Sender.Name} and you’re a Sales associate at Coral Cloud Resort writing an email to a new contact to verify their information on record.
Instructions:
"""
Introduce yourself welcome the new contact Andy Young. Let them know that you’re sending this email to verify their information. List the following information as a bullet list.
Full Name: {!$Input:Recipient.Name}
Company Name: {!$Input:Recipient.Account.Name}
Business Phone Number: {!$Input:Recipient.Phone}
Mobile Phone Number: {!$Input:Recipient.MobilePhone}
Email: {!$Input:Recipient.Email}
@amitastreait
amitastreait / MetadataUtil.java
Created May 20, 2024 07:27
Metadata API Salesforce Exaples
public class MetadataUtil {
private static final Integer METADATA_API_VERSION =
Integer.valueOf(new MetadataService.MetadataPort().endpoint_x.substringAfterLast('/'));
public static String fetchUserSessionId(){
String sessionId = '';
PageReference reportPage = Page.SessionId;
String vfContent = reportPage.getContent().toString();
@amitastreait
amitastreait / Get Refresh Token using the Postman Pre-Request Script.js
Last active October 18, 2025 16:27
Get Refresh Token using the Postman Pre-Request Script
if(pm.response.code === 200 || pm.response.code === 201){
var responseBody = pm.response.json();
pm.environment.set('access_token', responseBody.access_token);
pm.environment.set('refresh_token', responseBody.refresh_token);
pm.environment.set('scope', responseBody.scope);
pm.environment.set('id_token', responseBody.id_token);
pm.environment.set('instance_url', responseBody.instance_url);
pm.environment.set('token_type', responseBody.token_type);
<template>
<lightning-card variant="Narrow" >
<lightning-button if:true={messageList} variant="border-filled"
label="Chat with another customer" onclick={handleAnOtherChat} slot="actions">
</lightning-button>
<lightning-spinner alternative-text="Loading" size="small" if:true={isSpinner}></lightning-spinner>
<div class="slds-p-horizontal_small">
@amitastreait
amitastreait / ContentVersionTrigger.java
Created October 13, 2023 05:55
ContentVersionTrigger.java
trigger ContentVersionTrigger on ContentVersion (after insert) {
/*
* Develop a solution so that whenever a file is getting inserted under Task,
* Event or Case Object the same file should be linked to the related Account Record
*/
Set<Id> contentDocumentIdsSet = new Set<Id>();
/* Step1 - Get the content document Id */
for(ContentVersion version: Trigger.New){
contentDocumentIdsSet.add(version.ContentDocumentId);
}