Problems using server actions from another project

Did anyone ever do a video on how to connect to a database, log in a user, and show user data. I cant seem to get it to work, my web part is fine, server actions on the website end works brilliant. When I use those server actions in the mobile app I just cant get it to connect or do anything. Banging my head all day, wife starting to think I may have concussion :joy::joy:

Hello,
When you add a server connect component in the App Structure of your mobile project, when you open the “select server action” dialog, on the top left part of it you will see a projects dropdown.
Open it, then select your web project there, and select the server action you need.

I’ve already explained this in the following post:

1 Like

I have done this, but it doesnt seem to work. In the web app, i have set up all my actions, for log in, listing user etc, but on the mobile part nothing seems to happen. If i try to bind data for example there are no query to select from on the server connect. Hence asking if someone has done a 10 minute clip of setting this up, which i do think would be super helpful.

So you want to say that the problem is when you select your server action (from the web project), then you don’t see any bindings in the data picker, when trying to use them on the page?

Yes, that I cant seem to get the mobile app login to work either.
The web app is fine, its going brilliant.

Ok then, that explains your problem a little more.
Looking at your first post:

It doesn’t really explain what the problem is.

We are going to check this.

I added a serverconnect to my regular webproject, but I can’t seem to populate anything with data in the mobile project. No queries under data on the server connect

I am getting the same thing, @Johnny_Solberg, did you manage to resolve this ?

Try adding

<!--Security Policy-->
<meta http-equiv="Content-Security-Policy" content="default-src 'self' 'unsafe-inline' https://*/">

To the head area of your page. You may also have to add the full web url / path to some Actions, like below:

<!--Security Policy-->
<meta http-equiv="Content-Security-Policy" content="default-src 'self' 'unsafe-inline' https://www.DOMAIN.COM/dmxConnect/api/Access/AccessUserArea/AccessUserArea.php https://*/">

Domains separated by a space only, no commas.

You may also have to add or edit the following in your config.xml file

<access origin="https://DOMAIN.COM/dmxConnect/api/Access/LoginAccess.php"/>

Or you could just try with:

<access origin="https://*/*"/>

Dave, the issue reported here is more related to the UI and the data picker, than what actually happens on the page in the browser.
@evolvedtraining is having an issue where nothing appears under the server action, when he tries to use/bind dynamic data on the page.

This should be working just fine, but probably there’s a problem - we will investigate this.

Could be the same issue that Electron had where by the definer was not set:

<dmx-serverconnect id="UserProfile" url="https://www.DOMAIN.COM/dmxConnect/api/Profiles/User/UserProfile.php"></dmx-serverconnect>

Is missing site=“PROJECTNAMEofSERVERACTION”

<dmx-serverconnect id="UserProfile" url="https://www.cDOMAIN.COM/dmxConnect/api/Profiles/User/UserProfile.php" site="PROJECTNAME"></dmx-serverconnect>
1 Like

I am going to test this tomorrow, when we are back in the office :slight_smile:

1 Like

Not sure if this helps or not:

Actions and Query that work fine on web app.

Cant bind anything.

In Electron I had to add this manually before I could select any Bindings. Think I messaged George about it last week… :wink:

You need to add the definer as outlined above.

Simply add the definer and the name of the Project that contains the remote Server Action, ie site=“PROJECTNAME” inside the link to the Server Action.

Better post such issues in the bugs section, where we keep better track of them.
Personal messages can really get lost easily.

1 Like

Mine has a tip for yours, on how to deal with such situations… She needs wine, lots of it!

Us blokes need coffee and cake, lots of it!

:slight_smile:

Your a superstar Dave !!! That worked. Now i just need to see about getting log in form to work. Basically want the app to log user in and bring up there data and allow them to enter training data to the remote server…

1 Like

No worries happy I could help! I have working mobile apps (with full user permissions, data, and a lot of other features) built with Wappler but they do need some tweaking to get them to work, such as below:

I still haven’t got around to finishing off my guides for mobile but the above pretty much summarises the missing steps. Big tip is to make use of the debugging options in both Android Studio and Wappler to pin-point possible issues. That is how I found the above.

1 Like