Skip to main content
Question

Custom event condition

  • September 27, 2023
  • 6 replies
  • 392 views

Forum|alt.badge.img+9

Hello , 

 

I want to know what’s the right syntax to use the condition in custom event :

my condition is : NEW:CUSTOMER like 25% OR 15%.

Here what I’ve used , but it doesn’t work , I guess it’s a wrong syntax , Can anyone help me with that ?

 

Thank you in advance ,

Hanane

6 replies

Charith Epitawatta
Ultimate Hero (Employee)
Forum|alt.badge.img+31

Hi @Hanane,

Semi-colon should be the correct operator. Have you tried enclosing the values in single quotes? 

Eg: ‘25%’;’15%’

hope this helps!


Forum|alt.badge.img+10
  • Hero (Customer)
  • 123 replies
  • September 27, 2023

Hello @Hanane 

That wouldn’t be a nice solution, but I would make 2 custom actions.

On your first one, you would define the condition :

NEW:CUSTOMER_ID like 15%

And a second one with the condition

NEW:CUSTOMER_ID like 25%

 

Inside these 2 custom actions, you would put the exact same code


hhy38
Superhero (Customer)
Forum|alt.badge.img+16
  • Superhero (Customer)
  • 325 replies
  • September 27, 2023
Charith Epitawatta wrote:

Hi @Hanane,

Semi-colon should be the correct operator. Have you tried enclosing the values in single quotes? 

Eg: ‘25%’;’15%’

hope this helps!

I didn’t know it. :)

 

romsar wrote:

Hello @Hanane 

That wouldn’t be a nice solution, but I would make 2 custom actions.

On your first one, you would define the condition :

NEW:CUSTOMER_ID like 15%

And a second one with the condition

NEW:CUSTOMER_ID like 25%

 

Inside these 2 custom actions, you would put the exact same code

Probably, If I were faced with this scenario, I would use this way.

 

Forum|alt.badge.img+9
  • Author
  • Sidekick
  • 42 replies
  • October 2, 2023

Hello ,

Thank you all for the replies .

the single quotes didn’t work for me .

I included my conditions in my code , so it worked .

I used @romsar idea on another project , it’s very handy as well !

 

Kind Regards,

Hanane


Forum|alt.badge.img+10
  • Hero (Customer)
  • 123 replies
  • October 2, 2023

Hello.

Another idea and more handy than the idea I suggested would be to create a custom attribute.

In name, I would put IS_CUSTOMER_ID_OK

In server method, I would put something like 

MyPackageName.Get_Is_Customer_ID_OK(&NEW:CUSTOMER_ID)

 

I would define the procedure like this :

 

FUNCTION Get_Is_Customer_ID_OK(P_CUSTOMER_ID VARCHAR2) RETURN number

IS

BEGIN

 IF P_CUSTOMER_ID LIKE ‘15%’ OR P_CUSTOMER_ID LIKE ‘25%’ THEN

    RETURN 1;

ELSE

    RETURN 0;

END IF;

END Get_Is_Customer_ID_OK;

 

So, with this new attribute, in the event action screen, you put as new condition

IS_CUSTOMER_ID_OK = 1

And this way, you would have just 1 custom action.


Forum|alt.badge.img+9
  • Author
  • Sidekick
  • 42 replies
  • October 6, 2023

It’s a great idea if the conditions are the same .

My requirement is different for each customer_id ( depending on the prefix ) , so I’ll stick with two action events .

 

Thank you ,

Hanane


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings