Voicexml how to use an exception - exception

I want to use two exceptions.
the first:
The user can say (every time, in the whole application) "stop" and then the program exits.
the second:
I have following Code:
<form id="test">
<field name="test1">
<prompt bargein="true" bargeintype="hotword" > choose xy</prompt>
<grammar root="main" version="1.0" xml:lang="de-DE">
<rule id="main" scope="public">
<one-of>
<item>1</item>
<item>2</item>
<item>3</item>
</one-of>
</rule>
</grammar>
<nomatch>
didn't get it
<reprompt/>
</nomatch>
<noinput>
didn't hear you ?
<reprompt/>
</noinput>
<filled>
<assign name="myvar" expr="test1" />
<value expr="myvar"/> chosen
</filled>
</field>
</form>
I want that the user can say a word of my choice, and then a help-exception triggers - like
choose the following: x,y,z,...
how can i use such a exception handler?
thanks

I solved it like this:
I added an item:
<item>help</item>
and checked if the item was chosen:
<filled>
<if cond="test1 == 'help'">
<prompt>say xy.</prompt>
<goto next="#test" />
</if>
<assign name="myvar" expr="test1" />
<value expr="myZeitraum"/> chosen.
<goto next="#KPI" />
</filled>

Related

Localizing claims in custom policy

I have custom claims in my sign-up page register_header and password_header and I want to localize them to Japanese.
Here is my custom policy:
Claims
<ClaimType Id="register_heading">
<DataType>string</DataType>
<AdminHelpText>A claim responsible for holding response messages to send to the relying party</AdminHelpText>
<UserHelpText>A claim responsible for holding response messages to send to the relying party</UserHelpText>
<UserInputType>Paragraph</UserInputType>
</ClaimType>
<ClaimType Id="password_header">
<DataType>string</DataType>
<AdminHelpText>A claim responsible for holding response messages to send to the relying party</AdminHelpText>
<UserHelpText>A claim responsible for holding response messages to send to the relying party</UserHelpText>
<UserInputType>Paragraph</UserInputType>
</ClaimType>
Technical Profile
<TechnicalProfile Id="LocalAccountSignUpWithreadOnlyEmail">
<DisplayName>Email signup</DisplayName>
<Protocol Name="Proprietary" Handler="Web.TPEngine.Providers.SelfAssertedAttributeProvider, Web.TPEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
<Metadata>
<Item Key="IpAddressClaimReferenceId">IpAddress</Item>
<Item Key="ContentDefinitionReferenceId">api.localaccountsignup</Item>
<Item Key="language.button_continue">Continue</Item>
<Item Key="setting.showCancelButton">false</Item>
<!-- Sample: Remove sign-up email verification -->
<Item Key="EnforceEmailVerification">False</Item>
</Metadata>
<InputClaims>
<InputClaim ClaimTypeReferenceId="email" />
<InputClaim ClaimTypeReferenceId="readOnlyEmail" />
<InputClaim ClaimTypeReferenceId="givenName" />
<InputClaim ClaimTypeReferenceId="surName" />
<!-- claims needed for localization -->
<InputClaim ClaimTypeReferenceId="register_header" DefaultValue="Register account" />
<InputClaim ClaimTypeReferenceId="password_header" DefaultValue="Register password" />
</InputClaims>
<OutputClaims>
<OutputClaim ClaimTypeReferenceId="objectId" />
<!-- Sample: Display the readOnlyEmail claim type (instead of email claim type)-->
<OutputClaim ClaimTypeReferenceId="readOnlyEmail" Required="true" />
<OutputClaim ClaimTypeReferenceId="newPassword" Required="true" />
<OutputClaim ClaimTypeReferenceId="reenterPassword" Required="true" />
<OutputClaim ClaimTypeReferenceId="executed-SelfAsserted-Input" DefaultValue="true" />
<OutputClaim ClaimTypeReferenceId="authenticationSource" />
<OutputClaim ClaimTypeReferenceId="newUser" />
<!-- Optional claims, to be collected from the user -->
<OutputClaim ClaimTypeReferenceId="givenName" Required="true" />
<OutputClaim ClaimTypeReferenceId="surName" Required="true" />
<OutputClaim ClaimTypeReferenceId="TnC" Required="true" />
<!-- claims for localization -->
<OutputClaim ClaimTypeReferenceId="register_header" />
<OutputClaim ClaimTypeReferenceId="password_header" />
</OutputClaims>
<ValidationTechnicalProfiles>
<ValidationTechnicalProfile ReferenceId="AAD-UserWriteUsingLogonEmail" />
</ValidationTechnicalProfiles>
<!-- Sample: Disable session management for sign-up page -->
<UseTechnicalProfileForSessionManagement ReferenceId="SM-Noop" />
Content Definition
<ContentDefinition Id="api.localaccountsignup">
<LoadUri>Insert URL here</LoadUri>
<RecoveryUri>~/common/default_page_error.html</RecoveryUri>
<DataUri>urn:com:microsoft:aad:b2c:elements:contract:selfasserted:1.2.0</DataUri>
<LocalizedResourcesReferences MergeBehavior="ReplaceAll">
<LocalizedResourcesReference Language="en" LocalizedResourcesReferenceId="api.localaccountsignup.en" />
<LocalizedResourcesReference Language="ja" LocalizedResourcesReferenceId="api.localaccountsignup.ja" />
</LocalizedResourcesReferences>
Localized Resources
<LocalizedResources Id="api.localaccountsignup.ja">
<LocalizedStrings>
<LocalizedString ElementType="ClaimType" ElementId="register_header" StringId="DisplayName">アカウントを登録</LocalizedString>
<LocalizedString ElementType="ClaimType" ElementId="password_header" StringId="DisplayName">パスワードを登録</LocalizedString>
</LocalizedStrings>
My problem is the Japanese translation are returned as <label> in the HTML.
But their English counterpart is returned as <p> with the id attribute
I want to use the id but it is only available to the English translation.
Is there a way for the custom policy to change the text in <p> to Japanese and keep the id instead of creating a <label> element? If possible I don't want to use Javascript.
• I would suggest you to please try configuring the localization string ids in the custom policy regarding the two custom claims that you want to be translated in Japanese. Since you have already done the same as posted in your localization strings claims, I would suggest you to please modify your custom policy to also include the details below in it: -
<Localization Enabled="true">
<SupportedLanguages DefaultLanguage="en" MergeBehavior="ReplaceAll">
<SupportedLanguage>en</SupportedLanguage>
<SupportedLanguage>jp</SupportedLanguage>
</SupportedLanguages>
<LocalizedResources Id="api.localaccountsignup.en">
<LocalizedCollections>
<LocalizedCollection ElementType="ClaimType" ElementId="register_header" TargetCollection="Restriction">
<Item Text="StringId" Value="DisplayName" />
</LocalizedCollection>
<LocalizedCollection ElementType="ClaimType" ElementId="password_header" TargetCollection="Restriction">
<Item Text=”StringId” Value=”DisplayName”>
</LocalizedCollection>
</LocalizedCollections>
</LocalizedResources>
<LocalizedResources Id="api.localaccountsignup.jp">
<LocalizedCollections>
<LocalizedCollection ElementType="ClaimType" ElementId="<register_header in japanese" TargetCollection="Restriction">
<Item Text="StringId" Value="DisplayName" />
</LocalizedCollection>
<LocalizedCollection ElementType="ClaimType" ElementId="password_header in japanese" TargetCollection="Restriction">
<Item Text=”StringId” Value=”DisplayName”>
</LocalizedCollection>
</LocalizedCollections>
</LocalizedResources>
</Localization>
Might be when you edit your custom policy to include the display results as above, then you might be able to resolve the issue as desired. Also, do refer to the link below for more details about editing the custom policy as above.
Localised message for RestAPI error response in B2C custom policy

HTML template in xml - what kind of architecture is this?

My project has many xml files which are using to build html page & page operations. Here is the sample of grid template.
<Contact singular="Contact" indeal="" nodeal="ContactsPlaybook" tooltip="Document Playbook" library="true" tabHidden="true">
<ListingScreen handle = "PlaybookContacts.ashx" suppressCount="true" showFilters="true">
<IncludeScript src="scripts/jjedsEmaUser.js"/>
<SmartIcon editMode="false" requiredAction="Create" name="new" image="new.png" tooltip="Create" separator="false" href="PlaybookContactDetail.ashx?DealRef=${DealRef}" edit="true" />
<SmartIcon editMode="false" requiredAction="Delete" name="BulkDelete" image="delete.png" tooltip="Delete" separator="true"/>
<SmartIcon editMode="false" requiredAction="Read" actionOn="Contact" name="email" image="mail.png" tooltip="Email Team" href="PlaybookEmailTeam.ashx?DealRef=${DealRef}&Subject=Playbook&Body=${LinkToPage}" edit="true" />
<SmartIcon editMode="false" requiredAction="Read" name="print" image="print.png" tooltip="Print" onclick="javascript:window.print()" />
<!--<SmartIcon editMode="false" requiredAction="Administrate" name="CreateEmaUser" image="add_EMA_user.png" tooltip="Create EMA user" onclick="return emans.jjedsEmaUser.create('${DealRef}', '#ListingForm')" />-->
<Filters>
<Filter label="Functional Team" filter="FunctionalCategoryFilter" field="ContactGroupID" prefix="C" empty="FunctionalCategoryRef_NULL">
<PossibleValues displayProperty="Name" />
</Filter>
<Filter label="Country" filter="CountryFilter" by="name" prefix="AD" field="CountryID" displayProperty="Code" empty="-1">
</Filter>
<Filter label="Business Unit" filter="PickListIntFilter" field="BusinessUnit" prefix="C" empty="-1" onlyifsettingtrue="UseSpecialUserDealAccess">
<PossibleValues category="Deal" subcategory="BusinessUnit" />
</Filter>
</Filters>
<Sorting>
<SortColumn name="FullName" dir="asc"/>
</Sorting>
<Query alias="C" ignoreArchiving="true" ignoreDeal="true">
<Block by="C.ContactGroupID" resolveto="DepartmentName" as="Department" />
<JoinTo table="Address" alias="AD" from="C.AddressID" to="AD.AddressID">
</JoinTo>
<Constraint left="C.IsArchived" int="0" />
</Query>
<Column command="true" title="<input type='checkbox' header='true' onclick='ToggleCheckAll(this);'>" editMode="false" special="IsDelete" macro="Checkbox" onClick="ToggleCheckBox(this);"/>
<Column command="true" requiredAction="Update" title="" field="Blank" dbColumn="C.ContactID" macro="ImageLink" fieldType="Contact" tooltip="Edit" image="edit.png" edit="true" />
<Column title="Full Name" field="FullName" macro="LinkToRef" resolveto="FullContactName" from="C.ContactID" contactAlias="C" linkPage="PlaybookContactDetail.ashx"/>
<Column title="Organization" field="C.Affiliation" macro="Text" />
<Column title="Business Unit" field="C.BusinessUnit" property="BusinessUnit" macro="PickList" category="Deal" subcategory="BusinessUnit" storeInt="true" onlyifsettingtrue="UseSpecialUserDealAccess"/>
<Column title="Role" field="C.Role" macro="Text" />
<Column title="Phone" field="C.Phone" macro="Text" />
<Column title="Email" field="C.Email" macro="MailToRef" />
<DeleteDialog name="ContactDelete" info="If you really want to delete {0} please choose the contact which will be used instead."
title="Confirm delete" type="ContactDeleteDialog" >
</DeleteDialog>
</ListingScreen>
</Contact>
Can anyone tell me what kind of architecture is this and what is the real benefit of using this architecture?
It is used in Single page applications to populate the page using an ajax call from the browser to XML files/JSON files in the server thus avoiding reloading of the entire page.
Look into this example
https://www.w3schools.com/js/tryit.asp?filename=tryjs_ajax_xml2
Here on clicking the button the table gets loaded with the xml data from cd_catalog.xml
https://www.w3schools.com/js/cd_catalog.xml
Its architechture is similar to HTML in the way that both are markup languages.
The data is accessed using the nested structure of the tags.In the cd.catalog example the title column is accessed as catalog->cd->title.

Show value in validatorMessage

I am using a validatorMessage for a regex I have for an email input, but I want to show the current value from the input in the message, at the place {0}.
But if I used the variable that is declared in the bean it doesn't work, because it doesn't process the variables because there is an validation error. How would I show the current value in the input in the validatorMessage?
Note: {0} is used in the PrimeFaces locales for the current value with validating.
<p:inputText id="email" value="#{registerBean.email}" type="email" label="#{bundle.register_email}" required="true" style="width: 100%;" validatorMessage="#{bundle.register_email}: '{0}' #{bundle.register_email_error}">
<f:validateRegex pattern="^[_A-Za-z0-9-\+]+(\.[_A-Za-z0-9-]+)*#[A-Za-z0-9-]+(\.[A-Za-z0-9]+)*(\.[A-Za-z]{2,})$" />
</p:inputText>
The solution I propose is to use a custom "messages.properties" file and overwrite the default messages of JSF API.
For an example of this file please redirect to: jsf-api-2.x.jar, "javax \ faces \ Messages.properties".
Take for example the two values found in the file messages.properties
javax.faces.validator.LengthValidator.MAXIMUM={1}: Validation Error: Length is greater than allowable maximum of ''{0}''
javax.faces.validator.LengthValidator.MINIMUM={1}: Validation Error: Length is less than allowable minimum of ''{0}'
For example,
If maximum length validation failed, JSF gets “javax.faces.validator.LengthValidator.MAXIMUM”.
If minimum length validation failed, JSF gets “javax.faces.validator.LengthValidator.MINIMUM”.
Personalized Message
Create a file (with any name) for exemple: myMessages.properties and place them in a specific package in your source folder.
Place in all the messages you find in the file of the messages.properties jsf-api-api 2.x.jar .
Then change the message as you like, for example:
javax.faces.validator.LengthValidator.MAXIMUM=My custom message 1
javax.faces.validator.LengthValidator.MINIMUM=My custom message 2
Register Message Bundle
Register your custom properties file in “faces-config.xml”, put it as Application level.
faces-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<faces-config
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
version="2.0">
<application>
<message-bundle>
package.name.MyMessage
</message-bundle>
</application>
Demo
<h:form>
<h:panelGrid columns="3">
Enter your username :
<h:inputText id="username" value="#{user.username}"
size="20" required="true" label="Username">
<f:validateLength minimum="5" maximum="10" />
</h:inputText>
<h:message for="username" style="color:red" />
Enter your DOB :
<h:inputText id="dob" value="#{user.dob}"
size="20" required="true" label="Date of Birth">
<f:convertDateTime />
</h:inputText>
<h:message for="dob" style="color:red" />
</h:panelGrid>
<h:commandButton value="Submit" action="result" />
</h:form>
The source : click here

FuzzyLookup in BIML

I'm trying to do the following in BIML:
I'm at a bit of a loss on how to do this in BIML. Here is what I've tried:
<FuzzyLookup
Name="Fuzzy Lookup"
ConnectionName="WO7"
Exhaustive="true"
AutoPassThroughInputColumns="true"
>
<ExternalReferenceTableInput Table="map.AgencyWO7" />
<Inputs>
<Column SourceColumn="AgencyName" TargetColumn="AgencyName" />
</Inputs>
<Outputs>
<Column SourceColumn="AgencyId" TargetColumn="AgencyIdWO7" />
<Column SourceColumn="AgencyName" TargetColumn="AgencyNameWO7" />
</Outputs>
The result is the following error:
(-1,-1) : Error 5 : The input column for the
Fuzzy Lookup Fuzzy Lookup references external column that cannot be found in the reference table. Verify that the
input mapping references a valid column in the reference table.
Property TargetColumn. EmitSsis. There were errors during compilation.
See compiler output for more information.
I think you are maybe missing a reference to the previous transform which is effectively the joining arrow, had you been using SSDT.
Also the format I use to set passthrough = true is on a per column basis.
<FuzzyLookup Name="Fuzzy Lookup" MatchIndexName="" ConnectionName="WO7">
<InputPath OutputPathName="[Previous Transform Name].Output" />
<ExternalReferenceTableInput Table="map.AgencyWO7" />
<Inputs>
<Column MinSimilarity="85" MatchTypeExact="true" PassThrough="true" SourceColumn="AgencyName" TargetColumn="AgencyName" />
</Inputs>
<Outputs>
<Column SourceColumn="AgencyId" TargetColumn="AgencyIdWO7" />
<Column SourceColumn="AgencyName" TargetColumn="AgencyNameWO7" />
</Outputs>
</FuzzyLookup>
Try the above code, and if all else fails you can design the fuzzy look up in SSDT and then import it into biml using Mist/BimlStudio which is pretty reliable.
https://varigence.com/Mist
Cheers

JSON: How to log a JSON object value from a vxml?

My aim is to log a JSON object value fethed from a jsp file from the vxml. Is there any way to do that. I see that there is a function called JSON.stringify but thats giving me nothing as a log.
Below is my code:
<?xml version="1.0"?>
<vxml version="2.0" xmlns="http://www.w3.org/2001/vxml">
<var name="userId" expr="1" />
<!--form id="get_location"-->
<data name="userData" method="get" src="http://localhost:5000/userLocation.jsp" nameList="userId" />
<property name="inputmodes" value="dtmf"/>
<menu id="menuZero">
<choice dtmf="1" next="#choice1"/>
<choice dtmf="2" next="#choice2"/>
</menu>
<!--/form-->
<form id="choice1">
<block>
<if cond="userData.HttpResponse.do_queryResponse[&apos;return&apos;].errorMsg.result_code != &apos;0&apos;">
<goto next="welcome.vxml"/>
<else/>
<goto next="welcome.vxml"/>
</if>
</block>
</form>
<form id="choice2">
<block>
<log expr="JSON.stringify(userData.HttpResponse)"/>
</block>
</form>
</vxml>
Maybe, VoiceXML is not supported "JSON.stringify".
Try to get "json2.js" and add code.
<script src="json2.js" />
For example,
<?xml version="1.0" encoding="UTF-8"?>
<vxml
version="2.0"
xmlns="http://www.w3.org/2001/vxml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
<script src="json2.js" />
<var name="messageObject" expr="{keyA:'valueA',keyB:'valueB',keyC:'valueC'}" />
<form>
<block><prompt>Write Log!</prompt></block>
<block><log expr="JSON.stringify(messageObject)"/></block>
</form>
</vxml>
I tested this code on "Voxeo Prophecy 13".
I tried json2.js as described above and I had the same issue, 'assignment to undeclared variable JSON'. To fix this, I just declared in the same file (json2.js):
var JSON;
Then it worked properly. In the vxml:
<script><![CDATA[
prueba = new Object();
prueba.pepito = 1234;
prueba.OtraPrueba = "lalalapepe";
]]></script>
<log label="IVB_HISTORY">
<value expr="JSON.stringify(prueba)"/>
</log>
It gets logged as followed:
{"pepito":1234,"OtraPrueba":"lalalapepe"}
I'm using Convergy's InVision Studio