I can't find the CO data I need to create my token. | Community
Skip to main content
Travis_Schwartz
New Participant
January 28, 2020
Solved

I can't find the CO data I need to create my token.

  • January 28, 2020
  • 1 reply
  • 3540 views

I've been tasked with creating a campaign that is requiring velocity scripting. I thought I would know how to find the data, but I'm not able to.

So far I have the following:

#foreach( $list in $account_cList )
#if( $list.listID.equals("CreditLimit") )
#set( $targetList = $list )
#break
#end
#end

The problem is that there are several products that have the CreditLimit listID and so I need to add a qualifier of product types (a range of about 15-20, 4 digit codes). I'm not sure how to accomplish this part.

One more related issue is that I need the number that this token generates and subtract the number from another CO field:

( $list.listID.equals("balance"))

It would need to make sure it was referencing that same product type(s) as there are other lists that us the name balance (amount owed).

I would take the credit limit number, subtract the balance ( $math.sub), and the result would be a token that indicates that persons available amount.

Is my logic sound? Any tips in filling in the missing pieces?

Thank you Marketo Community.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by SanfordWhiteman

Some of our intermediate discussion was lost because of yesterday's migration of the Community from Jive to Lithium (which was expected, just had to forge on with support anyway!).

 

I'll repeat the answer to your question about subtracting and rounding those Currency fields (please mark it as correct):

 

#set( $customFormat = $number.getNumberFormat("currency", $convert.toLocale("en_US")) ) #set( $void = $customFormat.setRoundingMode($field.in($customFormat.getRoundingMode()).HALF_UP) ) #set( $roundedDifference = $customFormat.format( $math.sub($field1,$field2) ) )

 

And let me repeat for any lurkers: you absolutely, positively shouldn't be using the Currency datatype -- for anything -- though the ship may have sailed in Travis's case.

1 reply

SanfordWhiteman
New Participant
January 28, 2020

What do you mean by "the number that this token generates"? A specific numeric String property of the List object?

Travis_Schwartz
New Participant
January 28, 2020

The goal is that this token would identify the credit limit for the specific product(s) using the product types (which are also in the account file) vs a random product credit limit number. Does that answer your question?

An example: I want to know someones credit limit for a heloc (in this case) that they have on their account vs the credit limit they may have on a credit card.

SanfordWhiteman
New Participant
January 28, 2020

You need to state the CO schema (Velocity property names, original datatypes).

No reason to be general: if it's a number prop less another number prop, both of those prop names are explicitly part of the solution.