Is there a way to run a javascript when we are adding a new record

  • 0
  • 1
  • Question
  • Updated 6 years ago
  • Answered
When we are adding a new customer to the customer table, before creating this new record I want to check whether this customer is already present in one of my Old application. If it is present I will set the flag of a field to 1 else 0. As of now I am using a javascript button on a form page which will allow users to click and check whether the customer is present in the Old application or not, I think this is not a good way to do this as many users will try to use this button which will make the server loaded with requests. Is there a better way to do this or can we do this when adding a new record.
Photo of Azh7

Azh7

  • 30 Points

Posted 7 years ago

  • 0
  • 1
Photo of Mark_Shnier

Mark_Shnier

  • 640 Points 500 badge 2x thumb
Can you do a cross app relationship to check this instead of running javascript?
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 30,204 Points 20k badge 2x thumb
To get JavaScript to run automatically when a (new, view, edit, report or grid edit) page loads use (1) the image onload technique or (2) a browser extension.

I would not worry about the incremental HTTP traffic that clicking on a button has in calling the API to query a record as it will be a fraction of the payload that loading the form itself generates (there are dozens of CSS and JS files loaded with each page load).

Furthermore, I would look for a long term solution to migrate information in the old application to the new application as this could be accomplished as a one time batch migration. Keeping both applications active is just prolonging the problem. Retire the old application after merging the data into the new application.
Photo of Azh7

Azh7

  • 30 Points
Suppose we are using another software to push data to quickbase, i.e. create a new record, is there a way that during this creation period we can first check whether the data is present in the Old application or not, if it is there, than set a flag to yes. How to go about this?
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 30,204 Points 20k badge 2x thumb
You simply query the old application for the existence of a record using whatever business logic you define and based on the response modify the behavior of the form or API you are using to potentially add a new record to the new application. Without knowing what software you are using and if it is deployed from within a web page, server or desktop I can't provide any greater explanation as the methods to interact with the old and new application may be substantially different depending on what software and process you are using.
Photo of Surya

Surya

  • 0 Points
In reality, if the Old application is really old, why not copy all that data here like Dan suggested. However, for some reasons you can't do that, for eg,, in my situation, I have two applications for capturing the Customers data, one where they enter their own data and another where we enter their data for them. There are business reasons why we can't merge these two applications, so let us put aside any thoughts of merging these two.

To your point, I now have javascript that transfers the data from these applications, based on where it is entered by someone. If we created their record and it is copied to the other app, when they try to add their own data there, the system will not allow it because it is a duplicate.

Like Dan suggested, you could use the IMG ONLOAD technique for this purpose. Hope that helps.

This conversation is no longer open for comments or replies.