Concat dynamic value and static text on the FromEmail sender profile - dynamic-content

Let's say I would like to setup the FromEmailAddress of the sender profile with both dynamic value and static text. The FromEmailAddress would contain two parts : the account name which is dynamic and a static text '#email-3Dagency.com'. Here is an example of the output I would like for the Account named 'Digital Print' : DigitalPrint#email-3Dagency.com
The value of the field 'Account name' is filled by Salesforce Data when the journey runs. Indeed, account name is a data entry for the journey and the value comes from Salescloud. The account name is always filled in SF.
I had tried to create this Ampscript code in the from email field in the sender profile but the email is not sent when I run the journey:
%%[ set #fromemail = CONCAT(#accountname, "#email-3Dagency.com") set #accountname = AttributeValue("Account:Name") endif ]%% %%=v(#fromemail)=%%
Do you know how I can resolve the issue and if the code above is accurate ?

Related

Terraform variable user inputs long key value pair

I am using a 3rd party app called Morpheus (not a fan of it but its enforced)
I built some modules which are easy enough to request the end user selecting a "Catalog item" to be provisioned and asked for name, and drop down list with ex: instance size, etc.
My issue is thou, I need the user to enter in 1 long string of key value pair to be added to an attribute.
for example
parameters = [var.params]
and the end user inputs in the text field
"example1": "value1", "example2": "value2"
but of course this does not work. I tried {"example1": "value1", "example2": "value2"} and
parameters = [jsondecode(var.params)]
also does not work. Stuck on what / how to request end user to enter in the values in a specific format. The txt box is 1 liner btw :(, hence why im not a fan of morpheus but whatev's

Logic App (Read EmailID from database and send email)

Suppose I have two rows in a SQL table, with columns as Email,Record1,Record2.
Now if 'xyz#outlook.com' has two rows in table,
Email|Record1|Record2
xyz#outlook.com|Test1|Test2
xyz#outlook com|Test3|Test4
How can I send email to 'xyz#outlook.com', with 'Email Body' as , all the rows belong to that email ID.
Note: I need to read "To' in Email as dynamic value only
Table:
Email. Record1. Record2
xyz#outlook.com. Test1 Test2
xyz#outlook.com. Test3. Test4
A single email should be send to xyz#outlook com, with details in both the rows.
Please refer to my sample below:
I have a table(named "Emails") in sql like below screenshot:
In logic app, I created an action "Get row(V2)" to get one row of the table.
Then you can use the expression substring(body('Get_row_(V2)')?['email'], 0, indexOf(body('Get_row_(V2)')?['email'], '|')) to get the email address xyz#outlook.com from xyz#outlook.com|Test1|Test2.
============================Update=============================
For the update of your description, pleas refer to my sample.
I have a table like below screenshot:
In logic app, I use "Get rows(V2)" to get the rows of the table.
Then use the expression body('Get_rows_(V2)')?['value'][0]?['email'] as the value of To field when send email.
And in the Body of send email, use four expressions:
body('Get_rows_(V2)')?['value'][0]?['Record1']
body('Get_rows_(V2)')?['value'][0]?['Record2']
body('Get_rows_(V2)')?['value'][1]?['Record1']
body('Get_rows_(V2)')?['value'][1]?['Record2']

Google Form Search and Pull Spreadsheet Data

Hi I have google spreadsheet that contains customers' ID and their shipping status. I want to create google form where customers are able to input each of their own ID, with the return that the google form shows their shipping status.
I tried to look for solutions in internet but there was no luck. I am not really good in programming, i hope there is answer to this problem without having me to do some hard programming.
The sample case can be seen in here: https://docs.google.com/spreadsheets/d/14vSAeZxEJTzbNLLYEiref6qt-CMqiVi8alheLcIBugM/edit?usp=sharing
Google form should show something a little bit like is shown in cell D1:E3.
Where customers can fill the form with their own customer id, and the google form shows the status.
Consideration
There is no way to respond back in a Google Form directly. You can't show custom validation messages after From submission either.
Proposed solution
What about using email addresses additionally to the customerID to retrieve the shipping status? In this way you can easily build a notification system that will send an email if a matching customer ID is found in your spreadsheet.
To build such system you will have to build a Form with a Trigger.
It is required a bit of programming but I will try to cover the most important parts the best I can:
Adapt your Database structure
Add the customers email addresses in the column C in order to be able to retrieve it using the same customer ID.
| A | B | C |
|----+--------+-------|
| ID | STATUS | EMAIL |
Build the Form Trigger
In the Form you are using click on the 3 dots from the top menu and select Script Editor. Here you will write the code that will power your notification system.
function installTrigger() {
// This function instructs the program to trigger the checkID function whenever a form response is submitted
ScriptApp.newTrigger('checkID')
.forForm(FormApp.getActiveForm())
.onFormSubmit()
.create();
}
function checkID(e) {
// This function will parse the response to use the customer ID to retrieve email address and shipping status from the Spreadsheet Database
var responses = e.response.getItemResponses(); // Gets the form responses
var id = responses[0].getResponse(); // Assuming the first answer (index 0) is the customer ID)
var found = SpreadsheetApp.openById('spreadsheet_id')
.getRange('Sheet1!A1:C8') // The spreadsheet cells range in A1 Notation
.getValues() // Retrieve their values in rows
.filter((row) => row[0] == id); // Filter the rows for the provided customer ID
if (found) {
var status = found[0][1]; //Column B
var email = found[0][2]; //Column C
var subject = "Shipping Status";
var message =
`Hello!
The status of the order number ${id} is: ${status}.`
MailApp.sendEmail(email, subject, message);
}
}
Install the trigger
From the Script Editor top menu run the installTrigger() function: Run>Run function>installTrigger.
You are done
Following these steps you have successfully set up the notification system. Now you can start sharing the Form link and accept responses.
References
Installable Triggers
Mail App

How to set the "Ship To Select" shipping address dropdown field for a Sales Order?

When creating a Sales Order in NetSuite via Suitescript, we can successfully set the "Ship To" (Field ID: shipaddress) by sending it a string containing a full address.
This causes a problem because the "SHIP TO SELECT" dropdown field retains the default address set on the customer.
Ideally we would rather send in the valid ID from the Customer record and set the dropdown "SHIP TO SELECT" (Field ID: shipaddresslist) field using that ID.
We can get the valid ID, but cannot find a way to set that ID on the field in order to populate that dropdown.
Generally if you do this outside the context of a User Event Before Submit script you also need to make sure you save with sourcing.
var soRec = nlapiLoadRecord('salesorder' soId);
soRec.setFieldValue('shipaddresslist', addressId);
nlapiSubmitRecord(soRec, true);
// alternatively nlapiSubmitRecord(soRec, {enablesourcing:true [, disabletriggers:true|false, ignoremandatoryfields:true|false]});
If you are still seeing the old address text you might add:
soRec.setFieldValue('shipaddress', null);
before submitting.
If what you want to do is set a custom address then similar but you need to set the override:
var soRec = nlapiLoadRecord('salesorder' soId);
soRec.setFieldValue('shipaddresslist', null);
soRec.setFieldValue('shipoverride', 'T');
soRec.setFieldValue('shipaddress', formattedAddressString);
nlapiSubmitRecord(soRec);
Be warned though that doing this will make any searches or automation that rely on address fields miss or produce incorrect results around this record.
If you want a custom address you are generally better off:
var soRec = nlapiLoadRecord('salesorder' soId);
soRec.setFieldValue('shipaddresslist', null);
soRec.setFieldValue('shipaddr1', '123 Elm St.');
soRec.setFieldValue('shipcity', 'Portland');
...
nlapiSubmitRecord(soRec);

Get SPListItem in another format

I want to get different Rows from an SPListItem. I'll show you my problem with an example.
This code
Console.WriteLine(SPItemName["Created By"]);
or
Console.WriteLine(SPItemName["Created By"].ToString);
returns "8;UserName" (8 is the User ID).
If I look up the row in SharePoint Designer, i can choose even a format for this data field.
So i could get the html code of this field.
How to set the format (like html code or text) of a datafield in c#?
thanks
Use Either SPFieldLookupValue
If you need just the username, use SPFieldLookupValue to seperate id from value:
var userValue = new SPFieldLookupValue(SPItemName["Created By"] as string)
Then you can:
userValue.LookupValue to return UserName
userValue.LookupId to return Id
Or SPFieldUserValue
Or better yet, you can create SPFieldUserValue object to access any other user properties like email, login name, etc..
SPFieldUserValue objUserFieldValue = new SPFieldUserValue(web, SPItemName["Created By"].ToString());
Afterwards you can use:
objUserFieldValue.User.LoginName;
objUserFieldValue.User.Name;
objUserFieldValue.User.ID;
objUserFieldValue.User.Groups;
objUserFieldValue.User.Roles;
objUserFieldValue.User.Email;
objUserFieldValue.User.Sid;
objUserFieldValue.User.UserToken;
http://www.sharepointkings.com/2009/04/spfielduservalue-and.html
Note: to create SPFieldUserValue you must pass reference to web, that's because SharePoint has to get additional user information from user information list to construct SPFieldUserValue object.

Resources