let me try to make it more clear

On actions I can "Create a new entity"
Parameter: Entity type: Commerce Product, SKU: [node:field-prodcode], Type: Product, Title: [node:title], Creator: [node:author], Price: [node:field-price]
Provides variables: Created entity (entity_created)

then I can "Set a data value"
Parameter: Data: [entity-created:field-images], Value: [node:field-images]

field-images being a non standard product field

but when on another rule/action I do "Fetch entity by id"
Parameter: Entity type: Commerce Product, Identifier: [node:field-product:product-id]
Provides variables: Fetched entity (entity_fetched)

I can set the standard values i.e.
"Set a data value"
Parameter: Data: [entity-fetched:sku], Value: [node:field-prodcode]

BUT I can't "Set a data value"
with data selector "entity-fetched:field-images" or any other extra product field available above

which seems kind of ODD to me

Comments

giorgosk’s picture

field-images on the example above can't be found among DATA SELECTORS
and When I try to force "entity-fetched:field-images" as data I get following error

"The integrity check failed with the following error message: "action data_set: Missing configuration for parameter data."

bojanz’s picture

Title: rules:actions:set data value does not work for extra fields on fetched entity (only on created entity) » No tokens for custom fields
Category: bug » support
Status: Active » Fixed

That's because Token doesn't support custom fields yet. Commerce hacks around this using Entity API for the fields it creates, but for any other field, there's nothing.

The issue that's supposed to fix this is #691078: Field tokens.

giorgosk’s picture

great thanks for pointing this out

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

summit’s picture

Hi, sorry to add on a closed issue. But did anyone got this working please? I have an extra field on my commerce-customer-billing pane, but I am not able to get the value of this field into an email as a token...
greetings, Martijn

summit’s picture

Status: Closed (fixed) » Active

Hi,

Should that issue http://drupal.org/node/691078 fix this?
In this issue http://drupal.org/node/1108744#comment-4534788 is said
and it would be up to the modules providing those field types to also provide tokens once 691078 lands.
Isn't than drupal commerce not also needing something to do?
Set it to active because of that. If not correct sorry, then apologize.

Greetings, Martijn

summit’s picture

Hi,

Maybe this issue with rules helps: http://drupal.org/node/1290406#comment-5270044 ?
In this rule there is the field: field_payment_phone, that is also a custom field...

greetings, Martijn

summit’s picture

Hi,
I have the rule for sending email to users when making an order. I will look into this, if this way the correct values from a custom field are shown:

{ "rules_send_an_order_notification_e_mail_html_with_custom_field" : {
    "LABEL" : "Send an order notification e-mail with custom field (HTML)",
    "PLUGIN" : "reaction rule",
    "WEIGHT" : "4",
    "ACTIVE" : false,
    "REQUIRES" : [ "rules", "variable_email", "commerce_checkout" ],
    "ON" : [ "commerce_checkout_complete" ],
    "IF" : [
      { "data_is" : { "data" : [ "commerce-order:type" ], "value" : "commerce_order" } },
      { "entity_has_field" : {
          "entity" : [ "commerce-order:commerce-customer-billing" ],
          "field" : "field_koord"
        }
      }
    ],
    "DO" : [
      { "variable_email_mail" : {
          "to" : [ "commerce-order:mail" ],
          "variable" : "commerce_email_order_[mail_part]",
          "language" : "nl"
        }
      }
    ]
  }
}

Yes, after this rule I can set [commerce-order:commerce-customer-billing:field_koord] in my email, and it is filled with the value!
I do not know if this is correct rule-configuration, but it works.
May be someone can improve this?

Greetings, Martijn

rszrama’s picture

Status: Active » Closed (fixed)

Glad to see you got it working. This issue is almost a year old, though, so since you found your solution, let's leave it closed. It may be the Token module has advanced enough to do this stuff now, too.

summit’s picture

Hi, no, with latest token-dev this is not working. I was very pleased to see with rules I could solve this!
Greetings, Martijn