Tuesday, October 17, 2023

Issue - Quick Text Is Not Showing Under The Selected Folder After It's Created In Salesforce


QuickText : As name suggest it's used to configure the commonly used sentences or streamline the agents responses in chat, email and phone call to speed up the closure of the case etc. These are similar to email templates only but can be used across the multiple channels.

Ideally while creating these Quicktext we will be selecting the folder where this should go and save so that we can provide the access to these QuickText for an user using the folder only.

We have identified one issue where even after the desired folder selected while creating the new Quicktext but these Quicktext not showing under selected folder it's going under all folder/all QuickText .

So ,quick fix for this to update the folder for all these Quicktext can be done either using the Apex code snippet or using the SOQL.

Go to folder where you want to place the QuickText and copy the folder id from the url .

Just run the query on QuickText object to get the all the templates where FolderId is blank or you can just query your QuickText by using the Name.


  List<QuickText> lisQtextToUpdate = new List<QuickText>();
  for (QuickText qt :[SELECT Id,Name,FolderId From QuickText WHERE FolderId= Null])
  {
    qt.FolderId = <Your Folder Id>;
    lisQtextToUpdate.add(qt);
  }

  if (!lisQtextToUpdate.isEmpty())
     update lisQtextToUpdate;


Happy Learning 😊


 Please comment or write us if you have any queries/requirements.


Please like,follow,bookmark,subscribe this site to receive daily updates.


FaceBook Page - I Love Coding. You?


Hope this helps you..Enjoy..!







Monday, October 16, 2023

How To Check The Given Email Field Value Is Present In The List Of Email Ids In Salesforce Workflow, Formula and Flows

The use case here is I want to check whether case email is available given in the list of email ids or not? If it's present in the list it will return true else it will return false.


IF(

   FIND(Your Email Filed,'test@gmail.com,man.6233@gmail.com,hello@haptik.co,
pk.kk@gmail.com,support@jugnoo.in,msj@gmail.com,mailer-daemon@amazonses.com,
sales@kks.com,l.dyj@licindia.com') > 0,TRUE,FALSE
 
 )

Example:

IF(

   FIND(SuppliedEMail,'test@gmail.com,man.6233@gmail.com,hello@haptik.co,
pk.kk@gmail.com,support@jugnoo.in,msj@gmail.com,mailer-daemon@amazonses.com,
sales@kks.com,l.dyj@licindia.com') > 0,TRUE,FALSE
 
 )



Tuesday, August 15, 2023

Broadcasting /InApp Guidance in Salesforce

Want to broadcast some important information like downtime etc to all your Salesforce users through notifications on Salesforce Screen ?

Looking for something where you want to update all your users with latest release updates in a single screen or with multiple screens?

Want to understand how many of users are really acknowledged the latest features updates?

If you want to track all these metrics how much of customizations or coding i have to do πŸ€”? What if your a Salesforce Administrator want to do this

Don't worry either your a Salesforce Developer or Administrator we can do all these things less than 5 minutes without writing any code🀠 trust me you heard right πŸ‘‰


Yes in salesforce there is a inbuilt feature called “ InApp Guidance “. With help of this we can broadcast the important information to all your users with simple point and click. You can also share the recent release update in single screen or with navigation and you can also track who have viewed these release updates or gone through this funnel or not through Salesforce Reports.

Salesforce reference documents 

Happy Learning 😊 

Please follow and subscribe for more information. 

Thursday, June 8, 2023

How To Convert Array of Escaped Object String to String Object In Go Language

In our previous post we have learn how to convert the array/list of string objects into map and now with help of this map we can convert the array of objects in string format single object string.

Source Code:

package main

import (
	"encoding/json"
	"fmt"
)

type GenericHeader struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

func main() {

	escapeJsonString := "[{\"value\":\"123456\",\"key\":\"hash-key\"},
        {\"value\":\"srinivas4sfdc\",\"key\":\"requesting-host\"},
        {\"value\":\"token-based-authorization-policy\",\"key\":\"policy-name\"},
        {\"value\":\"application/x-www-form-urlencoded\",\"key\":\"Content-Type\"}]"
	fmt.Println("Input data:", string(escapeJsonString))
	var headers []GenericHeader
	err := json.Unmarshal([]byte(escapeJsonString), &headers)
	if err != nil {
		fmt.Println("Error:", err)
		return
	}

	headerMap := make(map[string]string)
	for _, header := range headers {
		fmt.Println(header.Key + ".." + header.Value)
		headerMap[header.Key] = header.Value
	}

	fmt.Println("Final Map Data==>", headerMap)
	marshalData, err := json.Marshal(headerMap)
	if err != nil {
		fmt.Println(err.Error())
		return
	}
	fmt.Println("marshalData==>", marshalData)
	fmt.Println("Final Object String ==>", string(marshalData))
}

Input Data String:

"[{\"value\":\"123456\",\"key\":\"hash-key\"},{\"value\":\"srinivas4sfdc\",\"key\":\"requesting-host\"},{\"value\":\"token-based-authorization-policy\",\"key\":\"policy-name\"},{\"value\":\"application/x-www-form-urlencoded\",\"key\":\"Content-Type\"}]"

Output Data String:

{"Content-Type":"application/x-www-form-urlencoded","hash-key":"123456","policy-name":"token-based-authorization-policy","requesting-host":"srinivas4sfdc"}



Please comment or write us if you have any queries/requirements.

Please like,follow,bookmark,subscribe this site to receive daily updates.


FaceBook Page - I Love Coding. You?


Hope this helps you..Enjoy..!

How To Convert Escaped Array of Objects String Into Map in Go Lang

Let's assume you have array of objects in escaped string format and you want to convert them to map[string]string we can use the below code format.

package main

import (
	"encoding/json"
	"fmt"
)

type GenericHeader struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

func main() {
	
	escapeJsonString := "[{\"value\":\"123456\",\"key\":\"hash-key\"},{\"value\":\"srinivas4sfdc\",\"key\":\"requesting-host\"},{\"value\":\"token-based-authorization-policy\",\"key\":\"policy-name\"},{\"value\":\"application/x-www-form-urlencoded\",\"key\":\"Content-Type\"}]"
	fmt.Println("Input data:", string(escapeJsonString))
	var headers []GenericHeader
	err := json.Unmarshal([]byte(escapeJsonString), &headers)
	if err != nil {
		fmt.Println("Error:", err)
		return
	}

	headerMap := make(map[string]string)
	for _, header := range headers {
		fmt.Println(header.Key + ".." + header.Value)
		headerMap[header.Key] = header.Value
	}

	fmt.Println("Final Map Data==>",headerMap)
}



Input Data:

"[{\"value\":\"123456\",\"key\":\"hash-key\"},{\"value\":\"srinivas4sfdc\",\"key\":\"requesting-host\"}]"

Output Data:

map[requesting-host:srinivas4sfdc hash-key:123456]



Please comment or write us if you have any queries/requirements.

Please like,follow,bookmark,subscribe this site to receive daily updates.


FaceBook Page - I Love Coding. You?


Hope this helps you..Enjoy..!


Thursday, April 20, 2023

How To Send Set of Ids or Set of Records From Lwc Component To Apex Method

If you're planning to use the set as the one of the parameter of your apex function and the same need to passed from lwc js look at these limitations below.

  • By default @AuraEnabled methods will not accept /allow to use the set of Records as the parameter. 
  • In detail, it's not only support set of Records even if you try to pass of set of Ids, set of strings and set of Records it will not work because it's doesn't support set data type it self.
The work around for this is 

  • The @AuraEnabled method again will support the list as a parameter so you either convert parameter from set to list is one option.
  • You can also try out the convert the set of Records into string in lwc using the Json.stringify() and change the your apex method param to string and inside method you can deserialize the string to set in side the apex method. 

Tuesday, April 18, 2023

Not exported by package compiler Unexported Name Error in Go Language

In Go language the functions can be exported with help of the keyword called "package" and same can be reused by importing in other classes with help of  key word called "import".

Even after making the function available to be used in other classes if your receiving the error called "not exported by package " please check if the below solution works for you.

The first letter of the function should be capital letter otherwise even you exported you can't find this function when you try to reference in other classes. So make sure that if any method that you want to re-used please declare with Capital letters.

firstClass.go
=======================================
package connectors

import (
 "fmt",
 "time"
 )
 
 func isNewToGoLang(string mobile) (isnew bool){
 
  if mobile == nil
    return false
  else
    return true
 }
 
 
secondClass.go
==================================
import (
  fclass "/connectors"
)

func checkAccess(){
  resp =: fclass.isNewToGoLang("1234")
  
}

Here I'm trying to access the method called isNewToGoLang() which is delcared in firstClass.go in secondClass.go ,even though i have exported the function still i'm getting an error because the first character of the method is small letter so it will not work.

As mentioned above if i update the method name with capital letter it will work as expected.


firstClass.go
--------------------------------------
package connectors

import (
 "fmt",
 "time"
 )
 
 func IsNewToGoLang(string mobile) (isnew bool){
 
  if mobile == nil
    return false
  else
    return true
 }
 
 
secondClass.go
------------------------------------
import (
  fclass "/connectors"
)

func checkAccess(){
  resp =: fclass.IsNewToGoLang("1234")
  
}

Please comment or write us if you have any queries/requirements.

Please like,follow,bookmark,subscribe this site to receive daily updates.


FaceBook Page - I Love Coding. You?


Hope this helps you..Enjoy..!

Monday, April 17, 2023

How Convert Pointer *bool to bool or *string to string in go lang functions

Most of the use cases in any technology the functions will be returning the some response either in string ,bool,float,int or some custom struct format. This is the basis use case in our regular programming.

Similarly in Go language if your writing any simple functions will return the same data types mentioned above or sometimes as pointer reference also will be returned.

In case if function returning the pointer reference how to converted the same pointer reference to it's underlying data type will be discussed in this post. If we are not converting we will be receiving the error as  "cannot use yourvariableName (variable of type *bool/string/int) as bool/string/int value in assignment compilerIncompatibleAssign "

Example : Pointer bool to bool or pointer string to string

package main

import "fmt"

func main() {
	var resp *bool
	resp = isNewToGoLang("8888888888")
	var isNewVar bool
	if resp != nil {
		isNewVar = *resp
		fmt.Println("Is New Var ", isNewVar)
	}
}

func isNewToGoLang(mobile any) *bool {

	varFalse := false
	varTrue := true
	if mobile == nil {
		return nil
	}
	if mobile != nil {
		return &varTrue
	}
	return &varFalse
}

Please comment or write us if you have any queries/requirements.

Please like,follow,bookmark,subscribe this site to receive daily updates.


FaceBook Page - I Love Coding. You?


Hope this helps you..Enjoy..!

Wednesday, March 29, 2023

How To Read The Values From Empty Interface Used During The JSON.Unmarshal in Go Language

When we don't know the type of the json structure or it's in dynamic nature usually we will use empty interfaces to handle these types.

Whenever you want to read values using the key from this empty interface ideally we need to convert this interface to map type interface using the type conversion.

Once it's converted to map we can use the map["keyname"] format to get the corresponding value from the json. 


Please comment or write us if you have any queries/requirements.

Please like,follow,bookmark,subscribe this site to receive daily updates.


FaceBook Page - I Love Coding. You?


Hope this helps you..Enjoy..!

How To Convert An Interface To String in Go Lang

 If you're trying to convert an interface{} or map of interface values to string use the fmt.Sprint() function. 

Please comment or write us if you have any queries/requirements.

Please like,follow,bookmark,subscribe this site to receive daily updates.


FaceBook Page - I Love Coding. You?


Hope this helps you..Enjoy..!

Friday, March 24, 2023

How To Convert Array to Slice in Go Language

Array is a fixed in size and can't be increased/decreased the size at run time where as Slices are dynamic in nature like can be decreased or increased the size automatically at runtime basis on the number of elements added to it.

To convert the array to slice at anytime we can use simply :(dot notation) shown in below


Source Code:

package main

import (
	"fmt"
	"reflect"
)

func main() {
	arr := [4]string{"go", "lang", "main", "sree"}
	fmt.Println("Arr is of type...", reflect.TypeOf(arr))
	arr2 := arr[:]   //Converts arr of type array to slice arr2
	fmt.Println("Arr2 is of type..", reflect.TypeOf(arr2))
}

Output:

Arr is of type... [4]string
Arr2 is of type.. []string




Please comment or write us if you have any queries/requirements.

Please like,follow,bookmark,subscribe this site to receive daily updates.


FaceBook Page - I Love Coding. You?


Hope this helps you..Enjoy..!




Thursday, March 9, 2023

How To Add List/Set of Records to List in Go Language

In Go language if we want to add single record/list of records we can use the append() method. But here is the trick adding the single item is pretty much forward and while adding the list/set of records we might face some issue.

Now we will discuss how to handle both the scenarios

Adding a single item/record to list/array:

package main

func main() {
	
	var finalItemList []string
	var singleItem string
	finalItemList = append(finalItemList, singleItem)

}

Adding multiple items/list to another list/array:

To add list of items to another list with help of append() we will receive an error as can not use variable of type of list/array as a data type value in argument to append.

To solve this simply we can just use Spread operator ... (3 dots) notation as shown below.

package main

func main() {
	
	var finalItemList []string
	var secondItemList []string
	finalItemList = append(finalItemList, secondItemList...)

}


Please comment or write us if you have any queries/requirements.

Please like,follow,bookmark,subscribe this site to receive daily updates.


FaceBook Page - I Love Coding. You?


Hope this helps you..Enjoy..!




Monday, February 13, 2023

How To Add a New Record To Existing List Of Records in LWC JS Controller

Let's assume we are getting  list of records from the apex to js controller and for some reasons if we want to add new row how can we add to it we can see below.

import { LightningElement, api, track, wire } from "lwc";
import fetchActivities from "@salesforce/apex/CancelFlowCntrl.fetchCanActivities";

const columns = [
    { label: 'ticketvalue', fieldName: 'totalTicketvalue' },
    { label: 'refundedAmount', fieldName: 'totalRefundedAmount' },
    { label: 'cancellationCharges', fieldName: 'totCancellationCharges' },
    
];

export default class ActivitiesFlow extends LightningElement 
{
  
  @track allActivitiesData;
  
  @wire(fetchActivities, { recdId: '$sfrecordId' })
    wiredActivities({ error, data }) {
       if (data) 
       {
          this.allActivitiesData =  data;
		  var newItem = {"totalTicketvalue": 100,"totalRefundedAmount": 90,"totCancellationCharges":10};
		  this.allActivitiesData.push(newItem);

		}
		
		else if (error) {
            this.error = error;
            this.allActivitiesData = undefined;
           
        }
	}
 }


Please comment or write us if you have any queries/requirements.

Please like,follow,bookmark,subscribe this site to receive daily updates.


FaceBook Page - I Love Coding. You?


Hope this helps you..Enjoy..!

How To Perform Arithmetic Operation in LWC Lightning Data Table In Salesforce

Let's assume we are getting a response from apex class for a cancelled ticket with details like total amount paid and refunded amount after cancellation.

If i would like to perform/display  the cancellation charges on screen with help of deducting the Total Refunded Amount from the Total Paid amount .In this article we will see how can we perform this in simple steps while using the LWC data table.

import { LightningElement, api, track, wire } from "lwc";
import fetchActivities from "@salesforce/apex/CancelFlowCntrl.fetchCanActivities";

const columns = [
    { label: 'ticketvalue', fieldName: 'totalTicketvalue' },
    { label: 'refundedAmount', fieldName: 'totalRefundedAmount' },
    { label: 'cancellationCharges', fieldName: 'totCancellationCharges' },
    
];

export default class ActivitiesFlow extends LightningElement 
{
  
  @track allActivitiesData;
  
  @wire(fetchActivities, { recdId: '$sfrecordId' })
    wiredActivities({ error, data }) {
       if (data) 
       {
          this.allActivitiesData =  data.map( record => Object.assign(
		{ "totalTicketvalue": record.apiResptotalTicketvalue, 
		  "totalRefundedAmount": record.apiResptotalRefundedAmount,
		  "totCancellationCharges": record.apiResptotalTicketvalue-record.apiResptotalRefundedAmount
		 },record
		)
            );
		}
		
		else if (error) {
            this.error = error;
            this.allActivitiesData = undefined;
           
        }
	}
 }

Please comment or write us if you have any queries/requirements.

Please like,follow,bookmark,subscribe this site to receive daily updates.


FaceBook Page - I Love Coding. You?


Hope this helps you..Enjoy..!