syntax error in replace expression for subject making in access - forms

i am very new to expressions in access,
In my access data base i need to parse some fields into subject of the outlook when send mail button clicked in the form , for this i am using replace expression as below :
=Replace(Replace("Rework |1: Reason|2:Drawing Number|3","|1",Nz([Order_Number],"")),"|2",Nz([Reason_for_rework],"")),"|3",Nz([Drawing_Or_Mat_Number],""))
but for this i am getting error as :
"the 'emaildatabaseobject' macro action has an invalid value for the 'subject' argument
Kindly help me how to solve this

You syntax is completely off. You may have Choose in mind:
=Choose(YourCategoryID,Nz([Order_Number],""),Nz([Reason_for_rework],""),Nz([Drawing_Or_Mat_Number],""))

Related

Microsoft Graph Api {"code":"ErrorInvalidPropertySet","message":"Set action is invalid for property."}

We use
PATCH https://graph.microsoft.com/v1.0/users/{userId}/{messageId}/
to update the just created email draft in order to send it later.
During the call we get 400 error with the next text -> '{"error":{"code":"ErrorInvalidPropertySet","message":"Set action is invalid for property."}}'
We get it only for several mailboxes.
What could be the possible reason?
Is it related to the mailbox configuration? What should we pay attention to?
If you are trying to update a message use
PATCH /users/{id | userPrincipalName}/messages/{messageid}
this way. This error mainly occurs when you try to set a read only property. Please check if the payload which you are using is having any property with readonly access. Also go through this document.
The issue was in internetMessageHeaders field.
We used this field in our PATCH payload, but it is not presented in PATCH method at all and sometimes Microsoft Graph API returns 400, but sometimes not.(even in case of no error this field is ignored)
So if you face this issue - just check whether you send the internetMessageHeaders field in your payload or not.
I guess it could be applied to all other readonly fields.

How to get buildbot build properties in the email subject while using MailNotifier?

I am trying to send custom email status notification on our buildbot system. I could not find a way to get build properties in the Email subject while using MailNotifier.
I found build object in the messageFormatter callback function parameter. But it can be used only in the body and not in subject.
I also tried using Json API by calling it from my master.cfg itself but it is not working and buildbot server goes on some kind of infinite loop. Json api if called separately works fine to query build specific data.
I am using buildbot 0.8.12 and I am new to this framework. Thanks for your help.
Per MailNotifier's docstring:
#param messageFormatter: function taking (mode, name, build, result,
master_status) and returning a dictionary
containing two required keys "body" and "type",
with a third optional key, "subject". The
"body" key gives a string that contains the
complete text of the message. The "type" key
is the message type ('plain' or 'html'). The
'html' type should be used when generating an
HTML message. The optional "subject" key
gives the subject for the email.
So you can just add one more item to the result dictionary and you get what you want. E.g.
...
return {..., 'subject': 'Abracadabra %s' % build.getProperty('my-favourite-build-property')}

Client context validation of data

As for tracking in AEM I am using CQ_Analytics for a scenario. We have a requirement like, I have to capture a value called "sort type" which is on the page when a user clicks on a button on that page and store it in ClientContext. I have written the below Javascript function which accepts a name argument. Using some code I am able to get hold of sort type value and passing it to the below function. Now my query is, how do I validate whether the name variable is assigned to the Client Context???
I have kept an alert statement and tried checking with multiple combinations but I am unable to figure out what is the correct way to conclude that my name value has been assigned to Client Context or not. Please help with my query.
function myFunction(name) {
CQ_Analytics.record({event: 'sorttype',
values: {'sortSelectedOption': name },
componentPath: '<%=resource.getResourceType()%>'
});
alert(CQ_Analytics.record.sorttype.sortSelectedOption);
}
You can see this post how to make your custom client context and how to store your data. http://blogs.adobe.com/aemtutorials/2013/07/24/customize-the-client-context/
After you create your client context, you have in the example CQ_Analytics.CustomStoreMgr.setTraitValue function that will save your parameter into client context.

Zend Validate, Display one message per validator

I am validating an email address using zend_validate_email.
For example, for email address aa#aa it throws several error messages including very technical describing that DNS mismatch (:S).
I am trying to make it display only 1 message that I want it to (for example: "Please enter a valid email").
Is there any way of doing it elegantly, apart from creating a subclass and overriding the isValid method, clearing out the array of error messages?
Thanks!
$validator = new Zend_Validate_EmailAddress();
// sets the message for all error types
$validator->setMessage('Please enter a valid email');
// sets the message for the INVALID_SEGMENT error
$validator->setMessage('Something with the part after the # is wrong', Zend_Validate_EmailAddress::INVALID_SEGMENT);
For a full list of errors and message templates see the Zend_Validate_EmailAddress class

Zend_Validate_Abstract custom validator not displaying correct error messages

I have two text fields in a form that I need to make sure neither have empty values nor contain the same string.
The custom validator that I wrote extends Zend_Validate_Abstract and works correctly in that it passes back the correct error messages. In this case either: isEmpty or isMatch.
However, the documentation says to use addErrorMessages to define the correct error messages to be displayed.
in this case, i have attached
->addErrorMessages(array("isEmpty"=>"foo", "isMatch"=>"bar"));
to the form field.
According to everything I've read, if I return "isEmpty" from isValid(), my error message should read "foo" and if i return "isMatch" then it should read "bar".
This is not the case I'm running into though. If I return false from is valid, no matter what i set $this->_error() to be, my error message displays "foo", or whatever I have at index[0] of the error messages array.
If I don't define errorMessages, then I just get the error code I passed back for the display and I get the proper one, depending on what I passed back.
How do I catch the error code and display the correct error message in my form?
The fix I have implemented, until I figure it out properly, is to pass back the full message as the errorcode from the custom validator. This will work in this instance, but the error message is specific to this page and doesn't really allow for re-use of code.
Things I have already tried:
I have already tried validator chaining so that my custom validator only checks for matches:
->setRequired("true")
->addValidator("NotEmpty")
->addErrorMessage("URL May Not Be Empty")
->addValidator([*customValidator]*)
->addErrorMessage("X and Y urls may not be the same")
But again, if either throws an error, the last error message to be set displays, regardless of what the error truly is.
I'm not entirely sure where to go from here.
Any suggestions?
I think you misinterpreted the manual. It says
addErrorMessage($message): add an
error message to display on form
validation errors. You may call this
more than once, and new messages are
appended to the stack.
addErrorMessages(array $messages): add
multiple error messages to display on
form validation errors.
These functions add custom error messages to the whole form stack.
If you want to display validation error messages when the validation fails, you have to implement the message inside your validator.
ie.
const EMPTY = 'empty';
protected $_messageTemplates = array(
self::EMPTY => "Value is required and can't be empty",
);
public function isValid($value)
{
if(empty($value)) {
$this->_error(self::EMPTY);
return false;
}
return true;
}
This way, after the validation fails, you can get the error codes using $validator->getErrors() and the error messages using $validator->getMessages().
If you have the $_messageTemplates properly defined, Zend_Form automatically uses the error messages instead of error codes and prints them out.
Hope this helps.