Please like,follow,bookmark,subscribe this site to receive daily updates.
LinkedIn Group - Srinivas4sfdc (I Love Coding... You?)
FaceBook Page - I Love Coding. You?
Please like,follow,bookmark,subscribe this site to receive daily updates.
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 )
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.
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)) }
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) }
"[{\"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.LinkedIn Group - Srinivas4sfdc (I Love Coding... You?)FaceBook Page - I Love Coding. You?
Hope this helps you..Enjoy..!
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".
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") }
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") }
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 }
If you're trying to convert an interface{} or map of interface values to string use the fmt.Sprint() function.
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)) }
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.
LinkedIn Group - Srinivas4sfdc (I Love Coding... You?)
FaceBook Page - I Love Coding. You?
Hope this helps you..Enjoy..!
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...)
}
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; } } }
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; } } }