addressused on email "from" attribute - dynamics-crm-2011

I'm using a pre-operation plugin on create of email to change the entity reference on the email's "from" attribute.
This is the code I use for the setting:
((EntityCollection)entity.Attributes["from"]).Entities[0].Attributes["partyid"] = erQueue; //erQueue is an entityReference of a certain queue
I also want the email to be sent from the queue email adddress, and not from the original sender's address.
should I also set the "addressused attribue of the "from" activityparty, or would it happen automatically?

CRM should default the email address used to primary email address of the selected record.
I've only used addressused in the past when I wanted to use an email address other than the primary email address of the selected record.
So in your case I don't think you need to set the addressused.
Slightly old documentation but still true and relevant I believe.
activityparty.addressused Property
The property activityparty.partyid contains the ID of an account,
contact, lead or systemuser. For account, contact or lead, the
property emailaddress1 is used as the default value for the e-mail
address. If this value is blank, emailaddress2 is used, and so on. For
systemuser, the default e-mail address is internalemailaddress.
To override this default, you can specify an alternate address as the value for addressused. For example, if you set addressused to the
value "someone#example.com", that e-mail address will be used.

After I checked, the email was sent with the email address of the original system user in the "from" field. So I had to change the addressused of the activityparty in the from attribute:
((EntityCollection)entity.Attributes["from"]).Entities[0].Attributes["addressused"] = sQueueEmailAddress;

Related

How to set to email from project.properties files

I need to trigger two emails for my application, one to logged-in user and one to customer-care.
For the customer care, I am setting the email id in project.properties and then hitting the event class:
deleteAccountSupportEvent.setAgentEmail(agentEmailAddress);
agentEmailAddress is picking email id from project.properties:
final String agentEmailAddress = getConfigurationService().getConfiguration().getString(DELETE_REQUEST_EMAIL_TO_AGENT);
I have set the email in Context class as well :
setAgentEmail(((PHDeleteAccountEmailProcessModel) processModel).getAgentEmail());
But instead of all this, mail is getting triggered to logged-in user.
Please help.
You can keep it simple as follows:
final String agentEmailAddress = getConfigurationService().getConfiguration().getString(DELETE_REQUEST_EMAIL_TO_AGENT);
setAgentEmail(agentEmailAddress);
As far as I know context is used for mail body dynamic content. There might be logic where to email addresses are added.

Macro send email, change 'from' Display Name but NOT email address

I have this:
.SentOnBehalfOfName = """Customer Service"" <customerservice#testing.test>"
the name "Customer Service" is officially associated with the email address. I'd like to change that display name to something else but keep using the same email address like this:
.SentOnBehalfOfName = """ABC Event CS"" <customerservice#testing.test>"
or
.SentOnBehalfOfName = """XYZ Event CS"" <customerservice#testing.test>"
But it always uses the default display name instead of the one I specify. Is it possible to achieve this in some way?
Exchange always uses the default name and the primary SMTP address when sending. If you want to change the display name and/or select one of the proxy addresses from a particular mailbox, sending through SMTP is the only option if you need to do that programmatically. In case of an end user, you can use a product like Proxy Manager (I am its author).

NetSuite: how to get or set a value for an OtherCustomField through SuiteTalk SOAP API

In the NetSuite Customization UI, I've defined an "Other Custom Field" which applies to Address. I've edited a Customer's Address and specified a value for this custom field. When I use a SuiteTalk SOAP request to "get" this Customer, the response includes all of the customer's data, including all of the address fields, but there's nothing that corresponds to the custom field's value for this address. This makes some sense since there's no "customFieldList" field to reference custom field values on an Address, as there is on the Customer itself and many other types of records. So how can I get or set the value of an "otherCustomField" for a particular record that it applies to (a particular Address in this case)? I've searched the NetSuite documentation, the support knowledge base and the internet, and so far, no luck.
And, yes, I already know how to get the metadata for the custom field itself using getCustomizationId and get/getList. But I need data, not metadata.

Accessing Address fields in Suitescript on Transaction level

In 2014.2 Netsuite changed it's structure of addresses making them subrecords. They have a lot of help around scripting addresses on the Customer level or Form level, however I need to on the transaction (quote, sales order, invoice) level.
Help for transaction level appears to be just this page: https://netsuite.custhelp.com/app/answers/detail/a_id/39551/kw/address
This however is creating a custom address which shows that custom billing and shipping addresses have their own internal id.
What is the internal ID that I can use on the nlapiViewSubrecord(fldName) call to get at the values of say country, state, zip, etc on the billing and/or shipping addresses? I have tried 'billaddress' and 'shipaddress' respectively with no luck.
Try billingaddress and shippingaddress. I've recently made a similar update to some of our Sales Order code, and this is what worked for me.
// {String} The type of address to create, will be one of ship or bill
var addressType = (type === 'ship' ? 'shippingaddress' : 'billingaddress');
// {nlobjSubrecord} Address subrecord object
var subrecord = order.createSubrecord(addressType);
(This is in a RESTlet; the type value here is something that gets sent to us)

possible to change To: field in email header?

I found a phishing email in my inbox that has my email address in the From: field, and an unknown email address in the To: field. It was made like I had sent the email to the unknown email address.
I'd like to ask if it is possible to change the To: field in the email header?
(I know it's possible to change the From: field in email)
Your email address was probably in the Bcc field.
If you don't see your email address in
the To: or Cc: fields of the header,
the sender has probably mailed you a
'blind carbon copy,' or Bcc:. The Bcc:
field isn't displayed in the header of
received messages. This means that you
won't see your email address at the
top of any message you receive as a
blind carbon copy.
Quoted from Receiving someone else's mail
No, it isn’t possible to use the To: header field to send an email to an address that isn’t in the To: header field, if the email is sent via SMTP.
Spammers very often use the Bcc: (blind carbon copy) header field to send email to an address that doesn’t appear in the To: header field or the Cc: header field. That is probably what has happened in this case. Your email address is probably in the Bcc: header field. The contents of the Bcc: header field is not shown by your email client.

Resources