I have an intent thats designed to be a POSSIBLE follow up intent. I don't want to assign it as a follow up because I want it to be used as an entry point. So for my parameters I assign the default value to the value passed in by the context.
And that works! As a follow up it works great and the context is passed through. However when I try any of the phrases without the context it goes to the "Default Fallback Intent."
Am I missing anything here?
I figured it out, I can leave the input context in Dialogflow blank and assign the value context as a default value of a parameter. As long as the context has been created from a previous intent it's all good. Now if you have a context it will use the context as a parameter, and if not it will you can prompt the user for a parameter. (Which you should export)
Related
I have a FM with structure in importing. When I try to change field value (wa_str-data = '31129999' for example), the change works, but when I get out of the FM, the field value is reset.
Is it possible to change the field value of a Function Module importing parameter which is of structured type?
Thanks to all.
No, you can't change the value of an IMPORTING parameter (unless it happens to be a TYPE REF TO, in which case you can change the value of the referenced object/data). You can only change values of CHANGING parameters. However, there is a dirty trick you might be able to use here. If you want to access the variable foo in the calling program Z_BAR, then you can do this:
FIELD-SYMBOLS <foo>.
ASSIGN ('(Z_BAR)FOO-DATA') TO <foo>.
IF sy-subrc = 0.
<foo> = newValue.
ENDIF.
(By the way, Z_BAR does not even need to be the direct caller of the function module. It just needs to be somewhere in the call stack.)
Why am I calling this a "dirty" trick?
It creates "spooky effects at a distance". Anyone examining Z_BAR would never expect a function module to change foo when it's not in its parameter list.
The variable name gets resolved at runtime, so there is no syntax check when you misspell it.
It breaks when the variable in the calling program gets renamed, and you won't know until it fails at runtime.
You need to know the name of the calling program in advance. When the function module gets called from another program, then it's not going to work anymore.
So I would only recommend this as a last resort measure.
In the Actions Console one can specify a NO_Match when a user's response does not match an existing parameter. But that NO_MATCH does not provide a transition to another scene. When the user input is not recognized, I want to return to the start of the conversation and start over. How can I do that?
It does seem odd that the only transition that NO_MATCH supports in the Actions Builder/SDK is to the (mandatory) End Conversation scene. But this is more a conceptual notion - NO_MATCH indicates that you want to attempt conversation recovery, or that you're giving up on it.
If you want to capture what is said and/or take action on it (ie - transition to a different scene) you can do something like this:
Create a Type that takes "Free form text" (I usually call it "Any"), by creating a type and selecting this for "What kind of values" will it support.
Create an Intent where all the sample phrases use this Any type - I've named it "fallback" in this example. You should specify that this is not a global Intent, since we only want it explicitly triggered in a Scene. Then create an intent parameter that uses the Any type and some sample phrases that use this parameter. Make sure you highlight some of the words in the phrases to show which parts are the "Any" type, since they won't automatically match.
Finally, in your scene, place this as the last Custom Intent. (Note that it must be the last Custom Intent, since they are evaluated in order.) You can then assign it to transition to whatever scene you want.
I want to create a .png file of a HTML page in angularjs and download it. For this I'm currently using dom-to-image.js and using the domToImage.toBlob function and passing the node element to it. But internally when it goes to dom-to-image.js it throws the error:
node.cloneNode() is not a function
Can anyone please assist me here?
Thanks
This error arises when you attempt to call cloneNode() on anything other than a single DOM node.
In this case, the error is coming from the dom-to-image library, which calls that method internally.
Note that without a code snippet, its hard to identify the precise issue with your code, but the point is, when you call domtoimage.toBlob(), you need to supply a single DOM node.
So double check what you are calling it with. If you are selecting by class, for instance, you could end up with more than one element.
Its best practice to be precise with which node you want to convert to a blob - use the id attribute, like this:
domtoimage.toBlob(document.getElementById('element')).then(...)
where element is the id of your target node.
Its also possible you're selecting with angular.element() or even using jQuery directly.
In both cases, this returns an Object -- which you can't call cloneNode() on.
Also note the following from the Angular docs for angular.element():
Note: All element references in AngularJS are always wrapped with jQuery or jqLite (such as the element argument in a directive's compile / link function). They are never raw DOM references.
Which means you would observe the same behavior in both cases, e.g. both of these:
domtoimage.toBlob($('#element')).then(...)
domtoimage.toBlob(angular.element('#element')).then(...)
would result in the error you see. You can index the Object before supplying it to domtoimage.toBlob(), perhaps like this:
domtoimage.toBlob($('#element')[0]).then(...)
domtoimage.toBlob(angular.element('#element')[0]).then(...)
and that would also work.
Also check out this post about "cloneNode is not a function".
I have an intent in DialogFlow that accepts an input/parameter from the user for validation purposes. The parameter is of fixed length and is alphanumberic (e.g. ABC1234). It is a random ID different for different users. The data input is validated at the backend using a webhook call.
In order for the input value to be accepted, I have to set the type of the parameter as #sys.any. It does work and the value is passed through to webhook for validation. But since this intent has no "Input contexts", the next intents are never triggered because each input from the user is evaluated to#sys.any.
What I need is a type that accepts custom value. But I can't find any.
Here is screenshot for the intent:
Also note that the next intent that doesn't get triggered has the "In context" = authentication
And user says expressions like book me. Due to #sys.any in the intent above, book me causes the above intent to trigger.
This question has similar requirements but no answers: DialogFlow - Improve entity/parameter recognition for alphanumeric parameters
Also: https://discuss.api.ai/t/alphanumeric-support/2572
So after some digging, I had to change the approach. That is, #sys.any is not the way to go. Instead of alpha-numeric, I opted to use the numeric part of the input param (last four digits) and handled any duplication at the server end/webhook. The type I used instead is #sys.number-sequence.
I still had to handle the contexts in a way that any input of number-sequence doesn't trigger this intent.
This is not possible on Dialogflow. You can achieve that in your webhook with a regular expression for example.
I'm using chrome's devtools to debug/modify a non-local javascript file(so I can't edit it).
The code is rather complex and defines function inside of functions and uses these pointers throughout.
The point is that I do not know where I'm exactly at in the process but I can set a breakpoint to a variable I need to modify. BUT I can't figure out how to modify it. I can add a watch or modify it under the locals panel BUT it won't actually change (after stepping once the value reverts to original)
So how can I change the variable? I don't know why it is so difficult. In my traditional debugging you can simply edit the value in the watch or locals and it will modify it. I've tried modifying it at the console but I guess I don't know the complete path to the variable and I always get an undefined variable.
All I want to do is modify a local variable or argument in side some function I set a breakpoint at.
Try doing this in the console. E.g.: window.myVar = "newValue"
First watch the variable, second in Scope tab you can change the value of the var!