0

I have tried with this code to retrieve and update

<script runat="server" type="text/javascript">
    Platform.Load("core", "1");
    if (Request.Method == "POST") {
    var fname= Request.GetFormField("FirstName");
    var lname= Request.GetFormField("LastName");
    var email = Request.GetFormField("Email");
    Write("UserMail::<br/>"+email);
    var updateDE = DataExtension.Init("EMP001");
    var status = updateDE.Rows.Update({Firstname:fname,LastName:lname},["Email"],[email]);
    Write(stringify(status));    
    }
</script>
%%[
set @email=AttributeValue("emailaddr")
Set @rowset=LookupRows("someDE","Email",@email)
set @row=Row(@rowset,1)
]%%

<html>
    <body>
        <form id="myform" method="Post" action=" http://pages.S7.exacttarget.com/page.aspx?QS=5c591a8916642e73f536137ce9a6af15a734cee467c322a9fa4cdca5dbb0d392" >
            FirstName: <input type="text" name="FirstName" placeholder="Your FirstName..." value="%%=Field(@row,"FirstName")=%% "/><br/>
            LastName: <input type="text" name="LastName" placeholder="Your LastName..."  value="%%=Field(@row,"LastName")=%% " /> <br/>
            Email: <input type="text" name="Email" placeholder="Your Email..." value="%%=Field(@row,"Email")=%% " /> <br/>
            <input type="submit" value="submit" /> 
        </form>
    </body>
</html>

here to retrieve I have used AMP script but I want to retrieve with ssjs and have to give value in the value to print the values I am facing difficulty there If anyone help me on this it would be great Thanks in Advance

1 Answer 1

1

You can do something like this to fetch the value from SSJS.

<script runat="server">
Platform.Load("core", "1");
var FirstName = '';
var LastName = '';
var EmailAddress = "[email protected]" //Request.GetQueryStringParameter("EmailAddress");
var de = DataExtension.Init("someDE");
var lookup = de.Rows.Lookup(["Email"],[EmailAddress]);
if (lookup.length > 0 ) {
    for (var i = 0; lookup.length > i; i++){
        var EmailAddress1 = lookup[i]["Email"];
        var FirstName = lookup[i]["FirstName"];
        var LastName = lookup[i]["LastName"];
    }

}
</script>

<html>
<body>
<form id="myform" method="Post" action=" http://pages.S7.exacttarget.com/page.aspx?QS=5c591a8916642e73f536137ce9a6af15a734cee467c322a9fa4cdca5dbb0d392" >
FirstName: <script runat="server">
            Platform.Load("core", "1");
            Write('<input type="text" name="FirstName" placeholder="Your FirstName..." value="'+FirstName+'"/>');
            </script><br/>
LastName: <script runat="server">
            Platform.Load("core", "1");
            Write('<input type="text" name="LastName" placeholder="Your LastName..."  value="'+LastName+'"/>');
            </script> <br/>
Email: <script runat="server">
            Platform.Load("core", "1");
            Write('<input type="text" name="Email" placeholder="Your Email..." value="'+EmailAddress1+'"/>')
            </script> <br/>
<input type="submit" value="submit" /> 
</form>
</body>
</html>
3
  • Hi , Thank you for your response I want to get email address as dynamically not statically. If we used static values its showing values if i have used dynamic like "Request.GetQueryStringParameter("EmailAddress");" its not showing value. can you please help me on this Jul 4, 2017 at 12:09
  • try to use Request.GetFormField("EmailAddress")
    – Abhishek
    Jul 4, 2017 at 14:36
  • Ya i have used but in output its showing not defined Jul 5, 2017 at 11:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .