Solved Scenario SkipIf

Status
Not open for further replies.

jonnip

Free User
Joined
Jan 11, 2024
Messages
7
Reaction score
4
For Call Journalling I am trying to skip a scenario if the response to a previous scenario is empty. It isn't working at the moment and I'm not sure why.

It's if the response of Scenario ReportCall UserCode is empty I want it to skip Scenario ReportCallSpokePost and instead go to Scenario ReportCallNotePadPost.

Code:
<Scenario Id="ReportCall" Type="REST">
      <Request SkipIf="[ReportCallEnabled]!=True||[EntityId]==&quot;&quot;" Url="https://crm-odata-v1.prospect365.com/Users?$Select=UserCode&amp;$Filter=EmailAddress eq '[AgentEmail]'" MessagePasses="0" RequestEncoding="UrlEncoded" RequestType="Get" ResponseType="Json">
        <Headers>
          <Value Key="Authorization" Passes="0" Type="String">Bearer [Bearer Token]</Value>
        </Headers>
      </Request>
      <Rules>
        <Rule Type="Any">value.UserCode</Rule>
      </Rules>
      <Variables>
        <Variable Name="UserCode" Path="value.UserCode">
          <Filter />
        </Variable>
      </Variables>
      <Outputs Next="ReportCallSpokePost" AllowEmpty="true">
        <Output Type="UserCode" Passes="0" Value="[UserCode]" />
      </Outputs>
    </Scenario>
    <Scenario Id="ReportCallSpokePost" Type="REST">
      <Request SkipIf="[ReportCallEnabled]!=True||[EntityId]==&quot;&quot;||[UserCode]==&quot;&quot;||[CallType]==Missed||[CallType]==Notanswered" Url="https://crm-odata-v1.prospect365.com/SpokeHistories" MessagePasses="1" RequestContentType="application/json" RequestEncoding="Json" RequestType="Post" ResponseType="Json">
        <Headers>
          <Value Key="Authorization" Passes="0" Type="String">Bearer [Bearer Token]</Value>
        </Headers>
        <PostValues Key="">
          <Value Key="ContactId" If="[EntityType]==contact" Passes="1" Type="String">[EntityId]</Value>
          <Value Key="DivisionId" If="[EntityType]==company" Passes="1" Type="String">[EntityId]</Value>
          <Value Key="Start" Passes="1" Type="String">[[CallStartTimeUTC].ToString("yyyy-MM-ddTHH:mm:sssZ")]</Value>
          <Value Key="Finish" Passes="1" Type="String">[[CallEndTimeUTC].ToString("yyyy-MM-ddTHH:mm:sssZ")]</Value>
          <Value Key="User" If="[UserCode]!=&quot;&quot;" Passes="1" Type="String">[UserCode]</Value>
          <Value Key="SpokeCode" If="[CallType]==Inbound" Passes="1" Type="String">INCOMI</Value>
          <Value Key="SpokeCode" If="[CallType]==Outbound" Passes="1" Type="String">MADECL</Value>
        </PostValues>
      </Request>
        <Rules>
            <Rule Type="Any">HistoryId</Rule>
        </Rules>
      <Variables>
        <Variable Name="HistoryId" Path="HistoryId">
          <Filter />
        </Variable>
      </Variables>
      <Outputs Next="ReportCallNotepadPost" AllowEmpty="true">
        <Output Type="HistoryId" Passes="0" Value="[HistoryId]" />
      </Outputs>
    </Scenario>
<Scenario Id="ReportCallNotepadPost" Type="REST">
      <Request SkipIf="[ReportCallEnabled]!=True||[EntityId]==&quot;&quot;" Url="https://crm-odata-v1.prospect365.com/Notepads" MessagePasses="0" RequestContentType="application/json" RequestEncoding="Json" RequestType="Post" ResponseType="Json">
        <Headers>
          <Value Key="Authorization" Passes="0" Type="String">Bearer [Bearer Token]</Value>
        </Headers>
        <PostValues Key="">
          <Value Key="ContactId" If="[EntityType]==contact" Passes="1" Type="String">[EntityId]</Value>
          <Value Key="DivisionId" If="[EntityType]==company" Passes="1" Type="String">[EntityId]</Value>
          <Value Key="DateTime" Passes="1" Type="String">[[CallStartTimeUTC].ToString("yyyy-MM-ddTHH:mm:sssZ")]</Value>
          <Value Key="Text" If="[CallType]==Inbound" Passes="2" Type="String">[[InboundCallText]]</Value>
          <Value Key="Text" If="[CallType]==Missed" Passes="2" Type="String">[[MissedCallText]]</Value>
          <Value Key="Text" If="[CallType]==Outbound" Passes="2" Type="String">[[OutboundCallText]]</Value>
          <Value Key="Text" If="[CallType]==Notanswered" Passes="2" Type="String">[[NotAnsweredOutboundCallText]]</Value>
          <Value Key="SpokeHistoryId" If="[HistoryId]!=&quot;&quot;" Passes="1" Type="String">[HistoryId]</Value>
        </PostValues>
      </Request>
      <Variables />
    </Scenario>
 
In your expression:
SkipIf="[ReportCallEnabled]!=True||[EntityId]==&quot;&quot;||[UserCode]==&quot;&quot;||[CallType]==Missed||[CallType]==Notanswered"

you're using 5 arguments with the OR operator. The expression evaluator can only take 2 arguments there, so you need to reformat that using chained IIf expressions, each one taking only 2 arguments.
 
In your expression:
SkipIf="[ReportCallEnabled]!=True||[EntityId]==&quot;&quot;||[UserCode]==&quot;&quot;||[CallType]==Missed||[CallType]==Notanswered"

you're using 5 arguments with the OR operator. The expression evaluator can only take 2 arguments there, so you need to reformat that using chained IIf expressions, each one taking only 2 arguments.
Thanks, I've rewritten it and now it's working as expected.
 
Good to know, this post will be marked as Solved ;)
 
Status
Not open for further replies.