Hi, @Karuppu_Samy!
It was not clear to me where you are trying to store the logged agent.
Since you talked about conversation, I believe that is on Freshchat.
Either way, the advanced storage behaves the same in all products.
On the store method, you can specify some options.
In your use case, I believe you want to store the logged user just in the first time of determined event.
If it is the case, please refer to the code below:
client.db
.set("ticket:101", { jiraIssueId: 15213 }, { setIf: "not_exist" })
.done(function (data) {
// success operation
// "data" value is { "Created" : true }
})
.fail(function (error_data) {
// failure operation
console.log(error_data.status);
console.log(error_data.message);
});
From: https://developers.freshchat.com/v2/docs/data-storage/#store:
-
Set If (setIf) : The setIf attribute takes any one of the two values: exist or not_exist . The {setIf: “exist”} code stores the value if the key exists in the data store and throws an error if the key does not exist in the data store. Similarly, {setIf: “not_exist”} stores the value if the key does not exist in the data store and throws an error if it is an existing key.
If this is not the case, please, clarity your query.