-2

I want to create a rule that takes an action whenever the overallStatus field of a Developer App is changed. But how do I do this since I think I cant use app-unchanged to compare the before and after state of the field?

Does anyone know how to do this?

This is an export of my current rule so far:

{ "rules_update_api_key_after_approval" : {
    "LABEL" : "Update API Key after Approval",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules", "rules_http_client", "devconnect_developer_apps" ],
    "ON" : { "devconnect_developer_app_update" : [] },
    "IF" : [
      { "entity_is_of_type" : { "entity" : [ "app" ], "type" : "developer_app" } },
      { "AND" : [
          { "entity_has_field" : { "entity" : [ "app" ], "field" : "field_status" } }
        ]
      }
    ],
    "DO" : [
      { "request_url" : {
          "USING" : {
            "url" : "My Company URL",
            "method" : "GET",
            "data" : "cred_status=[app:credentialStatus]\r\noverall_status=[app:overallStatus]\r\nstatus=[app:status]"
          },
          "PROVIDE" : { "http_response" : { "http_response" : "HTTP data" } }
        }
      }
    ]
  }
}

Note: Wwhen I access it from data comparison the field exists in app:overallStatus but when I use entity has field and choose app on the data selector, on the field selection it only shows taxonomy_forums, comment_body, body, etc and no overallStatus field. And it is Drupal 7.6.

  • What is a developer app? Did you attempt to write your own rules condition / action in code? – Kevin Jan 11 at 4:23
  • it is an entity when I used Drupal portal together with Apigee – Taufiq Abdullah Salim Jan 11 at 6:29
  • Maybe add a condition based on the time since the last update and don't continue..? Sort of like a flood protection. – mradcliffe Jan 27 at 5:09
1

Piece of cake:

  • add a Rules Condition like "Entity has field" (for your overallStatus field), which will make that field available for testing in subsequent Rules Conditions and/or Rules Actions.
  • add a Rules Condition (after the previous one, important!) to verify if the unchanged value of your overallStatus field is yes or no equal to the value of your overallStatus field (which is the value that would be saved).

PS: I'm assuming your question is about D7.

  • the thing is when I access it from data comparison the field exists in app:overallStatus but when I use entity has field and choose app on the data selector, on the field selection it only shows taxonomy_forums, comment_body, body, etc and no overallStatus field. I'm very sorry if my questions is not good since I'm very new to using both Drupal and Apigee. And yes it is Drupal 7.6 – Taufiq Abdullah Salim Jan 12 at 7:34
  • @TaufiqAbdullahSalim please extend (edit) your question to also include an export (created using the rules UI) of the rule you already have so far (even if the rule doesn't work yet). That'll provide way more details about what exactly you're trying to do. BTW, I "think" I know what your remaining issue might be (but I don't want to guess, which is why I wonder about your current rule). Please drop me an extra comment after you updated your question. – Pierre.Vriens Jan 13 at 17:53
  • I have updated my question with the export of my current rule – Taufiq Abdullah Salim Jan 14 at 3:44

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.