10 Replies Latest reply on Jul 6, 2016 11:10 AM by coherentkris

    Sending email (through server) data fields are empty

    Karend440

      Has anyone else encountered this?

      I have a script to to a find on certain email addresses, (find works ok) then send an email through the server (SMTP). However the email has the embedded text, but not the field info that should be next to it. The field info is just blank. Looks something like this:

       

      To:  Email addresses  ( find is okay)

      Subject:  New Job Notification for: (Field here is blank)

      Body:  Enclosed is a new job notification for customer:  (field here is blank), for PO number: (Field here is blank)

       

      I have the tables related, but not sure why the data is just not there. The message will send okay, the SMTP settings are correct, but the field data just won't show. Do all the fields need to be in the same table? or the same layout? I've tried putting them everywhere but cannot get this to work.

       

      Any ideas or suggestions? Been working on this one for... ever.

      Thanks!  Appreciate ANY help with this!

      Karen

        • 1. Re: Sending email (through server) data fields are empty
          karina

          Hi,

          Can you show us your script?

          • 2. Re: Sending email (through server) data fields are empty
            coherentkris

            post the file.

            My guess is that your script is trying to send from a context (layout) that does not have access to the fields you think it does

            • 3. Re: Sending email (through server) data fields are empty
              Karend440

              The script is a simple one:

               

              1. Go to Layout ["EmailList" (EmailList) ]

              2. Perform Find [Restore]

              3. Send Mail [ Send via SMTP Server; No Dialog ; To: EmailList::EmailAddress ; Subject: EmailList::SubjectEmail ; Message; EmailList::FlySheetSend]

              4. Go To Layout [ "SalesAdminItems" (Issues Tracking) }

               

              Screen Shot 2016-07-04 at 6.41.17 PM.png

              The fields SubjectEmail is a calculation:  "New Order Notification for "& Issues Tracking::Customer &  "WO#: " & Issues Tracking::Work Order Number

              and the field of EmailList:: FlysheetSend is also a calculation: 

               

              "New Order Notification for " & Issues Tracking::Customer & "¶¶"&

              "Part Description: " & Issues Tracking::Part Description & "¶¶"

              & "Part Number: " & Issues Tracking::CAD_PartNumber & ", Quantity of: " & Issues Tracking::Order QTY & "¶¶" &

              "Purchase Order Number: " & Issues Tracking::Purchase Order &"¶¶" &

              "Purchase Order Due Date:  "  & Issues Tracking::Customer Delivery Dates &"¶¶" &

              "This job is for the " &  Issues Tracking::Location & " Location"

               

               

              Do all these fields need to be in the same table or something? I've tried that also, but still didn't work. The only thing appearing is the straight text field.

              Thanks for the help, really, you have no idea how much I appreciate it.

              Karen

              • 4. Re: Sending email (through server) data fields are empty
                karina

                Hi,

                 

                Yes they all need to be in or related to the table from the layout EmailList.

                That were you sent the mail from.

                 

                If you put the fields on the layout EmailList do they have value then?

                Are your calculation fields a text or a number field? (should be text)

                 

                Can you show us your relationship graph?

                 

                 

                 

                • 5. Re: Sending email (through server) data fields are empty
                  Karend440

                  Yes, both calculations are text results.

                  If I put the other fields on the EmailList layout, they do not show. However, the 2 tables are related, as above, by a "WO" field.

                  It's basically, an email table, names and email addresses with a plant location. From there, I want to find a particular plant, to get those email addresses, then sent to those, the current record only with the fields selected from the Issues Tracking table. - these are the ones noted in the message body above. I wouldn't think it should be this difficult, LOL.

                   

                  Hope this info helps!

                  Karen

                  • 6. Re: Sending email (through server) data fields are empty
                    karina

                    Do you have the plant number in the issues tracking table and do you have the plant number in the emaillist table?

                    Can there be multiple emaillist records for one issue tracking record?

                    Is the issue tracking table also your work order table?

                    • 7. Re: Sending email (through server) data fields are empty
                      Karend440

                      The plant name is in the EmailList. The fields in the EmailList are:  Name, Email Address and Plant location.

                      I can do a find on a plant name and get those records I want to send the email to, that works fine.

                       

                      Yes, there are always multiple email address getting the same issue tracking record. Its just a new order has arrived notification. So one issue tracking record to many email addresses.

                       

                      Yes the Issue Tracking table is the main, large table, the Work Order table. It's related to the EmailList by WO number. - doesn't have to be, I don't think it really matters what the relationship is.

                      • 8. Re: Sending email (through server) data fields are empty
                        karina

                        Your relationships are important.

                         

                        The work ordernumber in the issues table has the same value as the work order number in the email list table?

                        Are they both numbers?

                         

                        If the fields are empty in your layout, they will be empty in your script also.

                        So thats the easy part

                        • 9. Re: Sending email (through server) data fields are empty
                          Karend440

                          Yes, the WO number in both tables are the same - as text. (sometimes they have -'s or letters in them).

                           

                          Maybe this is why it's not working? I don't really have a layout for emails. I have a table with email addresses and people's names, and a plant  location. I guess I am not understanding how I could have customer records on an email table. (WO number, customer name, address, etc..) where there are many of them, and also many email addresses.

                          What would match up to what? If the script is just calling for these variables from the current record, and the tables are related, I don't understand why it can't grab them from the current record, and place them where I have noted.

                           

                          Maybe this is something I need to do a join table for?

                           

                          Just throwing some thoughts out there... thanks again for the help.

                          • 10. Re: Sending email (through server) data fields are empty
                            coherentkris

                            if you are sending from a layout based on the EmailList table then the only reason that EmailAddress, SubjectEmail or Flysheetsend would be empty are if the calculations were wrong OR your perform find puts you in a found set of zero records.

                            The calculations rely on a relationship between the Issues Tracking table occurence and EmailList table occurence so you have to make sure the relationship is right on the graph and that the data is there in the linked fields to produce a match.

                             

                             

                            To check the second condition...

                             

                            Try

                            Go to Layout ["EmailList" (EmailList) ]

                            Perform Find [Restore]

                            If FoundCount > 0

                            Send Mail [ Send via SMTP Server; No Dialog ; To: EmailList::EmailAddress ; Subject: EmailList::SubjectEmail ; Message; EmailList::FlySheetSend]

                            Else

                            Custom Dialog message

                            end if

                            Go To Layout [ "SalesAdminItems" (Issues Tracking)

                             

                            Furthermore inserting a join table without thought nor reason suggests that you need to understand your data better and how it fits best in an RDBMS. Google normalization and data modeling to begin the learning process. You dont want to add an axle to your car when all you have is a flat tire.