Jump to content

Recommended Posts

Hi guys you may have done this before but i cant find it so i was wondering if you can help. I wish to create a button that when pressed creates a new record in a portal . I then wanted to go to this new portal line and copy from the same field in the previous line to this new line and so on. I tried this and couldnt get it too work so i did this.

 

I created fields in the customer layout with the names and serials of the equipment on that site. I then created the script to do a new portal row ( works fine) then copy from the customer field to the new portal row field . Basically im trying to duplicate the record . but with the new date. im probably going about this the wrong way hence my question. 

Please ignore the difference with the go to portal row last previous that was me experimenting .

Thanks for help

 

 

 

 

Screen Shot 2017-02-22 at 06.15.27.png

Share this post


Link to post
Share on other sites
1 hour ago, baweld123 said:

Basically im trying to duplicate the record . but with the new date.

So why don't you do just that?

Go to Portal Row [ Last ]
Go to Portal Row [ Select; Previous ]
Duplicate Record/Request
Set Field [ Service::Service Date; Get ( CurrentDate ) ] 

This is assuming that:

  • there are no other portals on the layout;
  • the relationship is defined to allow creation of records in the Service table;
  • the record you want to duplicate is shown in the last non-empty portal row.

Note that if the Service Date field is defined to auto-enter the current date, you won't need the last step.

---
Two unrelated notes:

1. As a general rule, you should avoid using copy/paste in your scripts, if only because it destroys the user's clipboard.

2. Your script reveals that you have numbered fields (Machine 1, Machine 2, Machine 3, etc.) fields in both tables. That's a symptom of poor structure. You should use multiple records in a related table.

 

Edited by comment
  • Like 1

Share this post


Link to post
Share on other sites

okay i take onboard what your saying ill give it a go. ill also rename the field correctly

 

 

Share this post


Link to post
Share on other sites

Hello, ok that works perfect but i must have my database setup wrong as it doesnt insert customer ID it starts a blank service but fills in all the data as required . 

service is connected by customer id match field . the portal is in the customer layout. Hope that makes sense

 

Screen Shot 2017-02-22 at 15.47.16.png

Share this post


Link to post
Share on other sites
6 hours ago, baweld123 said:

it doesnt insert customer ID

How exactly is this field defined (in the Service table)?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×

Important Information

By using this site, you agree to our Terms of Use.