1

I have a integer value that I'm trying to add to the title of a new node, but I can't figure out how to get it to work.

This the rule I have so far.

{ "rules_rule_create_bid" : {
"LABEL" : "Create a new Bid",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "button_field", "rules", "path" ],
"ON" : { "button_field_clicked" : [] },
"IF" : [
  { "button_field_compare_button" : {
      "clicked_field" : [ "field" ],
      "comparison_field_name" : "field_email_client"
    }
  },
  { "entity_has_field" : { "entity" : [ "entity" ], "field" : "field_client_email" } },
  { "entity_has_field" : { "entity" : [ "entity" ], "field" : "field_project_id2" } },
  { "entity_has_field" : { "entity" : [ "entity" ], "field" : "field_bid_count" } },
  { "entity_has_field" : { "entity" : [ "entity" ], "field" : "body" } }
],
"DO" : [
  { "entity_create" : {
      "USING" : {
        "type" : "node",
        "param_type" : "new_bid",
        "param_title" : "Default",
        "param_author" : [ "site:current-user" ]
      },
      "PROVIDE" : { "entity_created" : { "entity_created" : "Created entity" } }
    }
  },
  { "data_set" : {
      "data" : [ "entity-created:field-bid-contractorname" ],
      "value" : "[site:current-user]"
    }
  },
  { "data_set" : {
      "data" : [ "entity-created:field-bid-projectid" ],
      "value" : [ "entity:field-project-id2" ]
    }
  },
  { "data_set" : {
      "data" : [ "entity-created:field-project-description" ],
      "value" : [ "entity:body:value" ]
    }
  },
  { "node_path_alias" : {
      "node" : [ "entity-created" ],
      "alias" : "p_[entity-created:field-bid-projectid]_u_[site:current-user]"
    }
  },
  { "entity_save" : { "data" : [ "entity-created" ], "immediate" : "1" } },
  { "data_set" : {
      "data" : [ "entity-created:title" ],
      "value" : "New Project #[entity-created:field-project-id2]"
    }
  },
  { "redirect" : { "url" : "p_[entity-created:field-bid-projectid]_u_[site:current-user]#overlay=node\/[entity-created:nid]\/edit" } },
  { "drupal_message" : { "message" : [ "entity:field-client-email" ] } }
]
}
}

I want the entity:field_project_id to show in the title, but all I get is the project number.

1

Title is a string, that's why, in your rule, before setting title value, add a variable, then set variable value to the integer value, then add an action: "convert a data type": your variable, from integer to string, then set a data value, your node title as variable name. else leave the same as it is.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.