0

I have created rules component with some custom fields fc_home_city,fc_pin, fc_loan. When I am trying to execute then asking to fill text box value of fc_home, fc_pin and fc_loan manually I have attached screen shot below. I want to pass all the variables value from my database and calculate user points according to what he had fill in my custom registration form . How I will do it with custom code? Is any idea?

Ex:

In screen attached below after rules execution asking HOME CITY value but I want to pass Home city value from our end with custom code.

Thanks

Thanks

enter image description here

1 Answer 1

0

When you say "what he had fill in my custom registration form" do you mean that fc_home_city, fc_pin and fc_loan have equivalent fields on the user entity (probably called something like field_fc_home_city, etc)?

If so then I don't see why you are trying to populate those fields with code. One of the main advantages of the Rules framework is that you can can use the token selector system to pass in values nested into the objects you have to hand without having to write a line of code.

For example if you wanted to pass in the field_fc_home_city value of the current logged in user to the "Home city" field then you'd enter "account:field-fc-home-city" into that field and then every time it executes, that token will be replaced with the correct value for the current logged in user.

If it's not the logged in user you want to work with then so long as the component receives the user account as a parameter then you will be able to use the system to get the values from that user entity.

The javascript drilldown mechanism on the fields should help you get to the right token, otherwise you can press "Switch to direct input mode" and find the token in the "Replacement patterns" fieldset.

A good overview of how it works can be found here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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