Salesforce - Aura Component publish using message service issue - salesforce-lightning

I am trying to publish data from Aura to LWC. I am getting error to rectify what I am missing.
I checked multiple examples as syntax wise, still didn't work. Hence posting to see if anyone can help out.
Aura Component html:
<aura:component implements="flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId" access="global" >
More Information
<lightning:messageChannel type="AlertMessageChannel__c" aura:id="AlertMessageChannel"></lightning:messageChannel>
</aura:component>
Aura Controller JS:
({
publishMC : function(component, event, helper) {
var messageInfo = [
{ normalTxt: '', boldTxt: '', boldLeftTxt: 'This opportunity is Stale',
normalRightTxt: 'the stale reason code is EOD PAST DUE.'},
{ normalTxt: '', boldTxt: '', boldLeftTxt: 'This account has 1 or more Frame
Agreements', normalRightTxt: 'There is a Frame Agreement associated to the account,
if applicable, please link to this opportunity using the Contract ID field.'},
];
component.find("AlertMessageChannel").publish(messageInfo);
}
})
I have also added Message Service xml file too
<?xml version="1.0" encoding="UTF-8"?>
<LightningMessageChannel xmlns="http://soap.sforce.com/2006/04/metadata">
<description>This is a alert message channel communicator</description>
<isExposed>true</isExposed>
<lightningMessageFields>
<description>Header information passed into alert modal window</description>
<fieldName>alertHeaderInfo</fieldName>
</lightningMessageFields>
<lightningMessageFields>
<description>Body information passed into alert modal window</description>
<fieldName>alertBodyInfo</fieldName>
</lightningMessageFields>
<lightningMessageFields>
<description>Show/Hide information passed into alert modal window</description>
<fieldName>alertVisibleInfo</fieldName>
</lightningMessageFields>
<masterLabel>AlertMessageChannel</masterLabel>
But when try to load, getting error as :
Action failed: lightning:messageChannel$controller$init [Lightning Message Service - unrecognized MessageChannel reference: AlertMessageChannel__c]
Can any one help me, what I am missing?

The message seems to indicate that your Message Channel is not being recognized. The "masterLabel" is not the API name of your message channel, but rather the filename is. For instance if you have your xml defined in a file AlertMessageChannel.messagechannel-meta.xml then you can reference your channel with "AlertMessageChannel__c". If your filename is something different, like "TestChannel.messageChannel-meta.xml" then you have to use "TestChannel__c".

Related

Bot press chatbot is working fine is botpres editor, but failing in external website

I made a bot which is perfectly working in Botpress editor. But facing difficulty when added to external UI. I followed the instructions # https://botpress.io/docs/channels/web/ . But I am getting the below error
"13:06:59.118 DialogEngine Error processing “say
!builtin_text-lbs0Re” Err: Content element “!builtin_text-lbs0Re” not found "
However my content Json file contains the message
{ “id”: “builtin_text-lbs0Re”, “formData”: { “text$en”: “Hey, This is
Nexa. I would like to help you understand N8 Basic questions”,
“typing$en”: true, “variations$en”: [] },
My html page looks as below - SImilar to Botpress documentation
` window.botpressWebChat.init({ host: http://localhost:3000/', botId: 'your _bot _id_here' })
The error i am getting is
bp:dialog (bot) [z3AS4gXX8UuhjJ6sHfXEH] render element
“#!builtin_text-lbs0Re” +20s 13:06:59.118 DialogEngine Error
processing “say #!builtin_text-lbs0Re” Err: Content element
“!builtin_text-lbs0Re” not found Flow: main.flow.json Node: entry
[Error, Content element “!builtin_text-lbs0Re” not found] STACK TRACE
Error: Content element “!builtin_text-lbs0Re” not found at
DialogEngine._reportProcessingError
(/snapshot/build-mac/out/bp/core/services/dialog/dialog-engine.js:0:0)
at DialogEngine.
(/snapshot/build-mac/out/bp/core/services/dialog/dialog-engine.js:0:0)
at Generator.throw () at rejected
(/snapshot/build-mac/out/bp/core/services/dialog/dialog-engine.js:0:0)
at tryCatcher
(/Users/Downloads/botpress-v11_9_next-2019-05-21-darwin-x64/modules/.cache/module__0d92e45acb6587a48fca5bf12039dcea04d4f1f731482cc6548205bb16ee42d1/node_production_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler
(/Users/Downloads/botpress-v11_9_next-2019-05-21-darwin-x64/modules/.cache/module__0d92e45acb6587a48fca5bf12039dcea04d4f1f731482cc6548205bb16ee42d1/node_production_modules/bluebird/js/release/promise.js:512:31)
at Promise._settlePromise
(/Users/Downloads/botpress-v11_9_next-2019-05-21-darwin
Could someone please help me to point out the error?
Did you put your bot id?
window.botpressWebChat.init({ host: http://localhost:3000/', botId: 'MyBot' })

Workday: Put_Customer returning an error

We are using Snaplogic to load records into workday. Currently, extracting customer records from the source and trying to load them into workday using the object Put_Customer of web service Revenue_Management.
I was getting the following error:
But I'm not getting any category information from the source. So, I tried putting the value for Customer_Category_Reference as 1. But I ended up getting the following error.
The documentation for workday is not helpful and this has been a blocker for me for some time now.
Any help will be appreciated.
Update:
Trying to get customer categories using the Get_Customer_Categories object of Revenue_Management web service using Snaplogic. But getting the following error:
Failure: Soap fault, Reason: Processing error occurred. The task submitted is not authorized., Resolution: Address SOAP fault message and retry
Unfortunately I don't have access to a tenant at this time to validate . However it is likely to work based in prior experience . Perhaps you could create a customer in Workday, through the GUI. Then do get customer API call. Note the category reference . Then, use that in your put customer call
If you look at the API documentation, you will find that Put_Customer accepts a WID in the Customer_WWS_Data object. If you search for "Customer Categories" in Workday, you will likely find the report of the same name. Just select the category that you want your newly loaded customers to default to (click on the magnifying class, then on the ellipsis, Integration Ids, View Ids). The Workday ID will appear at the top.
I have not used the Revenue Management API, but my code for creating a position reference in the Compensation API is probably very similar to what you need to do for the Customer Category reference:
public static Position_ElementObjectType getPositionReference(string WID) {
return new Position_ElementObjectType {
ID = new Position_ElementObjectIDType[] {
new Position_ElementObjectIDType {
type = "WID",
Value = WID
}
}
};
}

Play form binding difficulties - How do I modify a request after getting it in the backend?

I'm currently trying to connect an Extjs form to a Play! Scala backend.
I have no problem receiving the request, but
FormName.bindFromRequest.get returns to me None .
I'm able to find the data generated via submitting from Extjs in the POST request in request.request.body.data (the first request object is generated by SocialSecure's controller), whereas normally the data bound to the form would be found in request.request.body.data.elems
I think Extjs's eschewal of using <form> in their inserted HTML is what causes me this problem, but I'd still like to take advantage of Extjs's nice form verification UI.
Does Play! or Scala have any resources for modifying a request after the server has received it?
More info
This is the method my /requestAudit cuurently points to after a POST request:
def requestAudit = SecuredAction(WithProvider("google")) { // SecureSocial syntax
implicit request => { // let's call this line 0'
println(request.request.body.asFormUrlEncoded) // let's call this line 1'
println(request.body.asText) // let's call this line 2'
newAuditForm.bindFromRequest.fold(
errors => BadRequest(views.html.error(newAuditForm))
success => { /*insert the object into my db*/ }
) } }
Ext.js request
When I'm debugging in Eclipse with an Ext.js form, the Variables window shows: (click for closeup)
where the form values are located in request.body.data.key1, request.body.data.key2, etc
Bootstrap form request
On the other hand, the request for Bootstrap has the values stored in request.body.data.elems
#2manyprojects 's suggestion set me on the right path:
newAuditForm.bindFromRequest(
(request.request.body.asFormUrlEncoded).getOrElse(Map()))
.fold( ... )
worked.
I was still getting form binding errors after changing my code to this, and then I discovered a typo in the name property of one of my Ext.js form fields. The name of the field must be the same on both the UI and the Play Form.

Using browser module to submit form in node.js

I used the browser module (https://github.com/shinout/browser) to test form submission in node.js and it was successful by running the following code:
var $b = new browser();
$b.submit({
from : 'https://accounts.google.com/Login',
selector: "#gaia_loginform",
data : {
Email : "XXXXXX#gmail.com",
Passwd : "XXXXXXXX"
}
});
// authenticated access
$b.browse('https://mail.google.com/mail/u/0/?ui=html&zy=d')
.after(); // browse after previously registered function
$b.on("end", function(err, out) {
console.log(out.url, out.result, out.responseHeaders);
});
$b.run();
But when I add additional code after $b.run()
$b.browse('https://mail.google.com').after();
$b.run();
I got the following error:
Junjo.register cannot be called when the template is frozen.
I don't know why. Any help would be appreciated.
From what I was able to read from sources, the browser module does not support running multiple jobs with single browser instance. Method $b.run() marks the object as frozen, which causes methods like browse to throw the error you are getting.

Editing Gateway Errors

How do you customize the Gateway Errors that pop up when a customer's credit card is declined.
Example would be "Payment transaction failed. Reason Gateway error: An error occurred during processing. Please try again."
We're using Authorize.net if that makes a difference. To clarify, we aren't looking to get rid of them, just modify the language in them.
Copy the file app/code/core/Mage/Paygate/Model/Authorizenet.php to local. Then find this (line 1334):
protected function _wrapGatewayError($text)
{
return Mage::helper('paygate')->__('Gateway error: %s', $text);
}
and replace with this:
protected function _wrapGatewayError($text)
{
if($text == 'This transaction has been declined.') {
$text = 'Custom message here.';
}
return Mage::helper('paygate')->__('Gateway error: %s', $text);
}
I know this is an old question, but I will leave this here for the future in case if someone runs into this.
The _wrapGatewayError() method already uses a helper to output the message, so why not just translate the message?
Create (or edit) your localization/translation file in app/design/frontend/{package_name}/{theme_name}/locale/en_US/translate.csv. You can check the active package_name and theme_name in System / Configuration / Design (under 'General').
Add the messages you are changing to that file in this format: "Old text - message you want to change", "New message".
In your case, it will be something like this:
"Payment transaction failed. Reason Gateway error: An error occurred during processing. Please try again.", "Your custom message"
How it works: whenever a helper is used to output the "Payment translation failed. ...", the system will find the translation file (translate.csv) and will change the message to your custom one.
Please don't modify core files. It creates a mess, interferes with patches, and makes debugging harder. You can extend them if you need to. See Overriding Magento blocks, models, helpers and controllers