Closed (fixed)
Project:
Rules URL Argument
Version:
7.x-1.2
Component:
Documentation
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
14 May 2013 at 13:25 UTC
Updated:
28 Apr 2017 at 13:50 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
paranojik commentedIf I understand correctly what you are trying to achieve, then you should be using the "Provide URL argument value" action with "campaign" as the "URL ARGUMENT NAME" which will provide a new variable that can be used in subsequent actions.
Hope this helps.
Comment #2
adam_b commentedThanks for your help, paranojik.
I've managed to extract the argument value, and it appears correctly if I set the token to display in a site message or email.
However, I'm unable to use it to set a data value for a tid or uid field. For example:
- Data > data selector > campaign (argument campaign)
- Value > data selector > [account:field-campaign:tid]
or
- Data > data selector > invite (argument invite)
- Value > data selector > [account:field-invited-by:uid]
In both cases the values are set as integers, which I assume is correct for tid and uid fields.
There are no error messages - but the fields remain blank.
Any ideas please?
Comment #3
adam_b commentedOkay, the previous comment may be irrelevant. I went through everything again and realized that I'd set it up backwards, but that seems to be the only way to get the variable.
I can set a TID value like this:
- Data > data selector > [account:field-campaign]
- Value > direct input > 26248
This works fine, and I wind up with the appropriate term in the user account.
However, the "campaign (argument campaign)" variable doesn't appear in the Value data-selector list. I've tried adding the variable and the token in the direct input field, but it only accepts an integer, so doesn't allow me to save it.
Sorry to bother you but am I missing something obvious? Thanks again.
Comment #4
fedegf commentedHello adam_b, paranojik,
first, thank you for this great module paranojik
If I understand adam_b correctly from your comments #2 and #3, we are looking for the same thing: a way to GET the value from an argument in the URL and SET a variable with this value.
It seems that this module is designed for just the opposite action: it READS a value from a variable and PUTS this value in the URL as an argument.
paranojik, maybe you can confirm that the action we are looking for can not be done with 'Rules URL Argument' or (hopefully) explain to us how to do it.
*EDIT*
I think that my problem is the following:
In the action "Provide URL argument value" I can not select "Entity reference" as variable type. This is the reason why I can not find my variable in the data selector later on, when adding the "Set a data value" action for an "Entity reference" variable.
So, the feature that I would like to request is to be able to select "Entity reference" as variable type. Shall I start a new issue?
Comment #5
adam_b commented@fedegf: yes, that's what I'm trying to do.
The module is able to get the value from an argument, and this can be output in a message or email - so that part is working fine.
It's setting the variable that doesn't work.
I'm afraid I'm not a developer so can't contribute any code or patches - but it would be really helpful to have this feature.
Comment #6
fedegf commentedHello adam_b,
I solved my problem. I configured (bolds are the variables that depend on your site):
- condition 'Check if URL argument exists'
Parameter: Argument: arg
- action 'Provide URL argument value' with data type "integer" and variable 'argument'
Parameter: Type: Integer, URL argument name: arg
Provides variables: arg_nid (arg_nid)
- action 'Fetch entity by id' with variable 'argument'
Parameter: Entity type: Node, Identifier: [arg-nid]
Provides variables: arg_entity (arg_entity)
- action 'Set a data value' with variable
Parameter: Data: [node:field-entity], Value: [arg-entity]
defining this condition and actions, I can access the variables in the right places.
I hope this explanation can help you.
*EDIT: I em'd and strong'd the 'Integer' parameter type because it is important. Action 'Fetch entity by id' will only accept an integer as nid for the entity*
Comment #7
paranojik commentedI'm glad you sorted it out. If you have any further questions, please attach the exported rule, so I can get a better overview of the problem.
@adam_b: As @fedegf already pointed out. It is VERY important how you set the data type of the expected argument. The rules Data selector will help you out (see screenshot).

If the data type cannot be fetched directly from the url, maybe some other Rules Action can provide that (e.g. The node data type can be fetched if you use the integer url argument value type and load a node by its nid). Experiment a little and get back to me If things don't work out.
Comment #8
adam_b commentedThanks to both paranojik and fedegf, I finally managed to get it to work :)
I just have one more issue, which is nothing to do with URL arguments but I'll ask here anyway.
The Campaign term-reference field in my original example ([account:field-user-tag]) allows multiple entries, but when I try to enter a new value it overwrites the existing entry at rather than adding a new one. I've tried using the [account:field-user-tag:0] through [account:field-user-tag:3] options, but this only allows me to target specific slots.
What I want is "add value X to the next vacant slot in multiple-value field Y". Any idea how I can do this?
Comment #9
bisonbleu commentedThis is a great module! I'm using it in combination with rules_link and entityform to update a subset of fields in a node.
Kudo @paranojik !
Comment #10
sketman commentedHello,
I am using Panels page manager to take over the display of some pages. In my particular case, I am overriding the Drupal Commerce Order page. The URL pattern is following: user/[uid]/orders/[order:id]; so for example: user/3/orders/232.
What I am trying to accomplish is to get the [order:id] argument from URL, so I am able to fetch this order in the next step.
Can I achieve it by this module please?
It looks to me that problem is that I can not add condition 'Check if URL argument exists', because I am not able to drill now in selection list to specify the data type. The data selector contains only basic site-related information, nothing else.
Any help would be appreciated.
Thank you.
Comment #11
paranojik commentedThis is task for the 'pathrules' module.
Comment #12
sketman commentedThank you for answer. I have seen that module, but from description I understood, that it only implements conditions to check arguments in URL.
I need to fetch the argument from URL, does this module do that?
Thanks again..
Comment #13
paranojik commented@sketman you chould open a feature request in the pathrules module then.
Closing as it seems to me all other questions have been answered.