Leiste mit Community-Erfolgen erweitern.

Submissions are now open for the 2026 Adobe Experience Maker Awards

Mark Solution

Diese Konversation wurde aufgrund von Inaktivität geschlossen. Bitte erstellen Sie einen neuen Post.

GELÖST

why hmacStr function is showing not defined in workflow javascript activity?

Avatar

Level 2

I have written an javascript code using hmacStr function inside workflow.

but every time got error as hmacStr not defined.

Please help.

Function I written in javascript activity

var hash1 = "abcd";
var key = "M2Y2YjkxZDEtYmNlOC1mYmI0LTkxZTgtOTNiY2RiMDhmN2E2YjExNGUwYjktNGJkYy1jZTM0LWQ1MWYtZGIwYWRlZTE0NGNh";

var encodeStr = hmacStr  (hash1, key , "SHA1");

logInfo(encodeStr);

hmacStr preset in jsAPi

1018495_pastedImage_3.png

1 Akzeptierte Lösung

Avatar

Korrekte Antwort von
Level 2

Hi @mousumid47477958,

Firstly key is optional and can be used to specify the encoding type. By default, Adobe Campaign uses UTF-8, but there is no harm is specifying it either.

Now, here is the magic... you should use HMACStr() instead of hmacStr() .

Sample Code:

var encodeStr = HMACStr("Adobe Campaign","UTF-8","md5");

logInfo(encodeStr);

Enjoy !

Regards,

Madhan

Lösung in ursprünglichem Beitrag anzeigen

2 Antworten

Avatar

Korrekte Antwort von
Level 2

Hi @mousumid47477958,

Firstly key is optional and can be used to specify the encoding type. By default, Adobe Campaign uses UTF-8, but there is no harm is specifying it either.

Now, here is the magic... you should use HMACStr() instead of hmacStr() .

Sample Code:

var encodeStr = HMACStr("Adobe Campaign","UTF-8","md5");

logInfo(encodeStr);

Enjoy !

Regards,

Madhan

Avatar

Level 1

Hi Madhan,

cbvmg Thank you