# Server-Side Scripting

**URL:** https://community.dreamfactory.com/c/server-side-scripting/14.md

[Latest](https://community.dreamfactory.com/latest.md) · [Categories](https://community.dreamfactory.com/categories.md) · [Tags](https://community.dreamfactory.com/tags.md)

---

## [About the Server-Side Scripting category](https://community.dreamfactory.com/t/about-the-server-side-scripting-category/21)

<div class="topic-metadata">

**Author:** [@benbusse](https://community.dreamfactory.com/u/benbusse)\
**Replies:** 0

</div>

Info about how to use server-side events and scripting with DreamFactory.

---

## [Custom password/reset service](https://community.dreamfactory.com/t/custom-password-reset-service/5184)

<div class="topic-metadata">

**Author:** [@LuchoRod](https://community.dreamfactory.com/u/LuchoRod)\
**Replies:** 11\
**Last updated:** [July 2, 2024, 6:48am UTC](https://community.dreamfactory.com/t/custom-password-reset-service/5184 "2024-07-02T06:48:12Z")

</div>

Hi guys, I want to know if there is a way to call the password reset api specifying an email template different from the default one. My scenario is this: we have the regular forgot password thing. But one admin user co…

---

## [Cannot connect to api from outside of DreamFactory](https://community.dreamfactory.com/t/cannot-connect-to-api-from-outside-of-dreamfactory/5265)

<div class="topic-metadata">

**Author:** [@akaHeimdall](https://community.dreamfactory.com/u/akaHeimdall)\
**Replies:** 0\
**Last updated:** [December 26, 2020, 8:55am UTC](https://community.dreamfactory.com/t/cannot-connect-to-api-from-outside-of-dreamfactory/5265 "2020-12-26T08:55:22Z")

</div>

I’ve connected everything successfully inside of DF: My services and roles are working correctly I can successfully execute the “Try Now” buttons in the API DOcs and I can view items on the Data page. I have CORS compl…

---

## [Python3 Scripts Return Error 500 In All Cases](https://community.dreamfactory.com/t/python3-scripts-return-error-500-in-all-cases/5262)

<div class="topic-metadata">

**Author:** [@ashman](https://community.dreamfactory.com/u/ashman)\
**Replies:** 0\
**Last updated:** [December 16, 2020, 5:52am UTC](https://community.dreamfactory.com/t/python3-scripts-return-error-500-in-all-cases/5262 "2020-12-16T05:52:17Z")

</div>

Hi all, I am attempting to use python scripts as a service and as a pre-post process script but in either case but I am getting the below response along with my initial request. “error”: { “code”: 500, “context”: nu…

---

## [Run script as admin](https://community.dreamfactory.com/t/run-script-as-admin/973)

<div class="topic-metadata">

**Author:** [@erikkurtu](https://community.dreamfactory.com/u/erikkurtu)\
**Replies:** 1\
**Last updated:** [April 6, 2015, 3:07pm UTC](https://community.dreamfactory.com/t/run-script-as-admin/973 "2015-04-06T15:07:03Z")

</div>

Is there anything in place in the current version for running a server-side script as an admin? Like a master key or something? I want to keep open registration off but allow new user registration only if the user provid…

---

## [How to talk with external nosql with service custom script](https://community.dreamfactory.com/t/how-to-talk-with-external-nosql-with-service-custom-script/2325)

<div class="topic-metadata">

**Author:** [@Rusher](https://community.dreamfactory.com/u/Rusher)\
**Replies:** 0\
**Last updated:** [March 7, 2016, 11:31am UTC](https://community.dreamfactory.com/t/how-to-talk-with-external-nosql-with-service-custom-script/2325 "2016-03-07T11:31:39Z")

</div>

I tried to use node custom script tutorial as a guide to test external nosql api that I setup in the service, but I gotten the following error error": { “context”: null, “message”: “Bad request. No token or api key pr…

---

## [When would \<event\>.queued be fired?](https://community.dreamfactory.com/t/when-would-event-queued-be-fired/4998)

<div class="topic-metadata">

**Author:** [@charleslcso](https://community.dreamfactory.com/u/charleslcso)\
**Replies:** 1\
**Last updated:** [June 12, 2020, 4:30pm UTC](https://community.dreamfactory.com/t/when-would-event-queued-be-fired/4998 "2020-06-12T16:30:10Z")

</div>

From this article, https://blog.dreamfactory.com/queueing-with-dreamfactory-scripting/ there are 3 events that can be fired when running GET api/v2/db/\_table/\<table\_name\>.get I understand the Pre-Process and Post-Pro…

---

## [Custom API - Unable to call GET on internal service](https://community.dreamfactory.com/t/custom-api-unable-to-call-get-on-internal-service/5178)

<div class="topic-metadata">

**Author:** [@rmadhavan](https://community.dreamfactory.com/u/rmadhavan)\
**Replies:** 1\
**Last updated:** [May 28, 2020, 4:22pm UTC](https://community.dreamfactory.com/t/custom-api-unable-to-call-get-on-internal-service/5178 "2020-05-28T16:22:34Z")

</div>

I am quite new to this platform and building things based on the documentation. Background: I want to create a Custom API which basically invokes a mongoDB service to pull the data from multiple tables and compose the …

---

## [Platform.api.patch](https://community.dreamfactory.com/t/platform-api-patch/1514)

<div class="topic-metadata">

**Author:** [@mrjohny](https://community.dreamfactory.com/u/mrjohny)\
**Replies:** 9\
**Last updated:** [January 14, 2020, 7:25pm UTC](https://community.dreamfactory.com/t/platform-api-patch/1514 "2020-01-14T19:25:13Z")

</div>

Hello, I'm struggling with getting my platform.api.patch script working. When trying it in API docs, it's working: I'm using: updateRecordsByFilter() - Update (patch) one or more records Table\_name = Status body = {…

---

## [Can't post or patch records using nodejs](https://community.dreamfactory.com/t/cant-post-or-patch-records-using-nodejs/4717)

<div class="topic-metadata">

**Author:** [@jps](https://community.dreamfactory.com/u/jps)\
**Replies:** 5\
**Last updated:** [January 10, 2020, 11:48pm UTC](https://community.dreamfactory.com/t/cant-post-or-patch-records-using-nodejs/4717 "2020-01-10T23:48:31Z")

</div>

Using DreamFactory 2.14 (Bitnami image, EC2) I had to upgrade the supplied nodejs from version 6 to the latest stable (version 10) to get a response from platform.api.get. But platform.api.post is still broken, as is pl…

---

## [Platform.api not working in NodeJS scripts to access Mongo](https://community.dreamfactory.com/t/platform-api-not-working-in-nodejs-scripts-to-access-mongo/3469)

<div class="topic-metadata">

**Author:** [@rbarriuso](https://community.dreamfactory.com/u/rbarriuso)\
**Replies:** 2\
**Last updated:** [January 10, 2020, 11:32pm UTC](https://community.dreamfactory.com/t/platform-api-not-working-in-nodejs-scripts-to-access-mongo/3469 "2020-01-10T23:32:04Z")

</div>

I'm trying to issue a request from a NodeJS service in DF 2.2.1 like platform.api.get("mongodb/\_table/myTable") but the script seems to crash without any other clue but returning the message "Executed command returned wi…

---

## [Nodejs npm Module require Error](https://community.dreamfactory.com/t/nodejs-npm-module-require-error/4914)

<div class="topic-metadata">

**Author:** [@navjinder](https://community.dreamfactory.com/u/navjinder)\
**Replies:** 5\
**Last updated:** [January 7, 2020, 9:49pm UTC](https://community.dreamfactory.com/t/nodejs-npm-module-require-error/4914 "2020-01-07T21:49:06Z")

</div>

I have installed dreamfactory on Azure using the bitnami image. I am creating a service using nodejs. When I am trying to call lodash it gives me error. Even though the files are present in the storage/scripting director…

---

## [Nodejs service returns undefined](https://community.dreamfactory.com/t/nodejs-service-returns-undefined/5099)

<div class="topic-metadata">

**Author:** [@LuchoRod](https://community.dreamfactory.com/u/LuchoRod)\
**Replies:** 0\
**Last updated:** [January 7, 2020, 6:52am UTC](https://community.dreamfactory.com/t/nodejs-service-returns-undefined/5099 "2020-01-07T06:52:59Z")

</div>

Guys, i’ve created a node.js service in DF using 2 packages (speakeasy and qrcode). In that service i’m trying to define some functions according to Node custom scripting service math tutorial but when the script tries t…

---

## [Pre-Process Scripts Not Working As Expected (NodeJS, DF 3.0.1)](https://community.dreamfactory.com/t/pre-process-scripts-not-working-as-expected-nodejs-df-3-0-1/5096)

<div class="topic-metadata">

**Author:** [@pbeverage](https://community.dreamfactory.com/u/pbeverage)\
**Replies:** 1\
**Last updated:** [December 26, 2019, 10:29pm UTC](https://community.dreamfactory.com/t/pre-process-scripts-not-working-as-expected-nodejs-df-3-0-1/5096 "2019-12-26T22:29:33Z")

</div>

So, I will cut this very short, because my patience and my tolerance for things not working correctly is basically gone at this point. According to the documentation, I can modify data before it hits an API / Database, …

---

## [Custom scripts directory](https://community.dreamfactory.com/t/custom-scripts-directory/1294)

<div class="topic-metadata">

**Author:** [@maurip](https://community.dreamfactory.com/u/maurip)\
**Replies:** 6\
**Last updated:** [December 6, 2019, 6:46pm UTC](https://community.dreamfactory.com/t/custom-scripts-directory/1294 "2019-12-06T18:46:18Z")

</div>

Hello, I have a question: I want to create a scheduled task that is able to launch every day a custom script. In the panel of Task scheduler of Windows I must locate the file \*.js that I want to launch. The problem is th…

---

## [Error - Failed to open stream: Permission denied](https://community.dreamfactory.com/t/error-failed-to-open-stream-permission-denied/5021)

<div class="topic-metadata">

**Author:** [@Reto](https://community.dreamfactory.com/u/Reto)\
**Replies:** 0\
**Last updated:** [August 21, 2019, 8:42am UTC](https://community.dreamfactory.com/t/error-failed-to-open-stream-permission-denied/5021 "2019-08-21T08:42:23Z")

</div>

Hi We are trying to use server-side scripting. But there is a permission problem. { "error": { "code": 500, "message": "file\_put\_contents(C:\\\\inetpub\\\\wwwroot\\\\dreamfactory2\\\\dreamfactory\\\\storage\\\\scripting\\\\x…

---

## [Passing variables from Pre-Process to Post-Process scripts](https://community.dreamfactory.com/t/passing-variables-from-pre-process-to-post-process-scripts/4997)

<div class="topic-metadata">

**Author:** [@charleslcso](https://community.dreamfactory.com/u/charleslcso)\
**Replies:** 0\
**Last updated:** [July 30, 2019, 12:09pm UTC](https://community.dreamfactory.com/t/passing-variables-from-pre-process-to-post-process-scripts/4997 "2019-07-30T12:09:25Z")

</div>

Hello, I’m new to DreamFactory but I’m starting to get the hang of it. I’m on Bitnami 2.14.1-13. I’m playing with Scripts. Managed to get Pre-Process and Post-Process scripts working by following the examples in various…

---

## [Queued Scripting Working Inconsistently](https://community.dreamfactory.com/t/queued-scripting-working-inconsistently/4996)

<div class="topic-metadata">

**Author:** [@CrystalTaggart](https://community.dreamfactory.com/u/CrystalTaggart)\
**Replies:** 0\
**Last updated:** [July 29, 2019, 3:49pm UTC](https://community.dreamfactory.com/t/queued-scripting-working-inconsistently/4996 "2019-07-29T15:49:26Z")

</div>

I’m trying to get a queued script to work and have read the 3 documents in the wiki and 4 posts on this. If I only select ‘Queue For Later Execution’, it processes synchronously. If I set the connection to ‘database’ i…

---

## [Call Stored Procedure from PHP server scripts](https://community.dreamfactory.com/t/call-stored-procedure-from-php-server-scripts/4975)

<div class="topic-metadata">

**Author:** [@radodr](https://community.dreamfactory.com/u/radodr)\
**Replies:** 0\
**Last updated:** [June 26, 2019, 9:01pm UTC](https://community.dreamfactory.com/t/call-stored-procedure-from-php-server-scripts/4975 "2019-06-26T21:01:51Z")

</div>

Hello, I have installed Dream Factory from github v 2.14.0, I use service with MariaDB service. In php server script I call StoredProcedure with parameters. First call is ok, but second and others finish with error in …

---

## [Cannot return image raw bytes](https://community.dreamfactory.com/t/cannot-return-image-raw-bytes/4967)

<div class="topic-metadata">

**Author:** [@regalartech](https://community.dreamfactory.com/u/regalartech)\
**Replies:** 0\
**Last updated:** [June 21, 2019, 8:51am UTC](https://community.dreamfactory.com/t/cannot-return-image-raw-bytes/4967 "2019-06-21T08:51:06Z")

</div>

I am chaining a API through dreamfactory using custom python scripts but the it seems the dreamfactory API does not allow to response raw image data. Note : I am not using dreamfactory’s file services.

---

## [Undefined offset: 1 while registering user from Services](https://community.dreamfactory.com/t/undefined-offset-1-while-registering-user-from-services/4958)

<div class="topic-metadata">

**Author:** [@Ved\_Prakash](https://community.dreamfactory.com/u/Ved_Prakash)\
**Replies:** 1\
**Last updated:** [June 20, 2019, 10:25am UTC](https://community.dreamfactory.com/t/undefined-offset-1-while-registering-user-from-services/4958 "2019-06-20T10:25:33Z")

</div>

Hi, We had a script which was registering user through Server Side script which looks like this $options = \[\]; $options\['headers'\] = \[\]; $options\['headers'\]\['X-DreamFactory-Api-Key'\] = $platform\['session'\]\['api\_key'\]; $…

---

## [How to manipulate data on the fly with server side scripts](https://community.dreamfactory.com/t/how-to-manipulate-data-on-the-fly-with-server-side-scripts/930)

<div class="topic-metadata">

**Author:** [@whalan84](https://community.dreamfactory.com/u/whalan84)\
**Replies:** 8\
**Last updated:** [June 11, 2019, 12:54pm UTC](https://community.dreamfactory.com/t/how-to-manipulate-data-on-the-fly-with-server-side-scripts/930 "2019-06-11T12:54:25Z")

</div>

Hi, I am new to Dreamfactory. I am trying to modify a field on all of the records of a REST call using get.post\_process event script. I am struggling to get my head around it a little. I have manipulated some examples I …

---

## [SQL Record pre-processing not saving records](https://community.dreamfactory.com/t/sql-record-pre-processing-not-saving-records/4936)

<div class="topic-metadata">

**Author:** [@damion](https://community.dreamfactory.com/u/damion)\
**Replies:** 0\
**Last updated:** [June 10, 2019, 7:33pm UTC](https://community.dreamfactory.com/t/sql-record-pre-processing-not-saving-records/4936 "2019-06-10T19:33:17Z")

</div>

var lodash = require("lodash"); if (event.request.payload.resource) { lodash.\_.each(event.request.payload.resource, function( record ) { record.user\_name = platform.session.user.name; console.log(rec…

---

## [Can't add script on Twilio or AWS SES services](https://community.dreamfactory.com/t/cant-add-script-on-twilio-or-aws-ses-services/4929)

<div class="topic-metadata">

**Author:** [@Mark0](https://community.dreamfactory.com/u/Mark0)\
**Replies:** 0\
**Last updated:** [May 31, 2019, 2:40pm UTC](https://community.dreamfactory.com/t/cant-add-script-on-twilio-or-aws-ses-services/4929 "2019-05-31T14:40:41Z")

</div>

I have set up Twilio and AWS SES as a services. If I go to Scripts, I can see these as endpoints, and can select them down to post\_process, pre\_process etc. But if I try to write a script in here the save button is alw…

---

## [Passing parameters to a procedure](https://community.dreamfactory.com/t/passing-parameters-to-a-procedure/4922)

<div class="topic-metadata">

**Author:** [@Mark0](https://community.dreamfactory.com/u/Mark0)\
**Replies:** 2\
**Last updated:** [May 30, 2019, 9:03am UTC](https://community.dreamfactory.com/t/passing-parameters-to-a-procedure/4922 "2019-05-30T09:03:05Z")

</div>

I have read all the topics in the wiki and community, but I am still struggling with this. It seems many do. I want to send some json data ot a table named ‘test’, e.g: {“resource”: \[{“column\_one”: “val1”, “column\_tw…

---

## [Unable to find whether the script is being executed or not?](https://community.dreamfactory.com/t/unable-to-find-whether-the-script-is-being-executed-or-not/2363)

<div class="topic-metadata">

**Author:** [@Krishna\_G](https://community.dreamfactory.com/u/Krishna_G)\
**Replies:** 7\
**Last updated:** [March 23, 2016, 6:29pm UTC](https://community.dreamfactory.com/t/unable-to-find-whether-the-script-is-being-executed-or-not/2363 "2016-03-23T18:29:29Z")

</div>

HI, I have created a post process script in v8js. But the script is not being executed. Here is the script I have written: print(“Starting FirstTable post process”); var\_dump(event.response); // outputs to file in s…

---

## [Rest api -\> kafka](https://community.dreamfactory.com/t/rest-api-kafka/3880)

<div class="topic-metadata">

**Author:** [@tlk](https://community.dreamfactory.com/u/tlk)\
**Replies:** 1\
**Last updated:** [May 6, 2019, 2:09pm UTC](https://community.dreamfactory.com/t/rest-api-kafka/3880 "2019-05-06T14:09:26Z")

</div>

Hi all, Can anyone provide steps on how to write a custom script to publish to kafka? Thanks

---

## [Replacing LAMP Stack with DF (server-side & server less)](https://community.dreamfactory.com/t/replacing-lamp-stack-with-df-server-side-server-less/4888)

<div class="topic-metadata">

**Author:** [@tropicaltwin](https://community.dreamfactory.com/u/tropicaltwin)\
**Replies:** 3\
**Last updated:** [April 17, 2019, 3:36pm UTC](https://community.dreamfactory.com/t/replacing-lamp-stack-with-df-server-side-server-less/4888 "2019-04-17T15:36:47Z")

</div>

I have an existing site using the traditional LAMP stack to present a dynamic website. My intention is to attempt to port this using serverless techniques. Currently I host this from my own domain, from my own hardware.…

---

## [Modify PHP Script Engine - Add New Script Type](https://community.dreamfactory.com/t/modify-php-script-engine-add-new-script-type/4862)

<div class="topic-metadata">

**Author:** [@murrayl](https://community.dreamfactory.com/u/murrayl)\
**Replies:** 0\
**Last updated:** [March 27, 2019, 12:24pm UTC](https://community.dreamfactory.com/t/modify-php-script-engine-add-new-script-type/4862 "2019-03-27T12:24:20Z")

</div>

I have seen a couple of articles about referencing self contained classes from within the PHP scripting capability. Looking at the code, this is done via an Eval. A major disadvantage of the Eval is the ability to debug…

---

## [Python import external modules](https://community.dreamfactory.com/t/python-import-external-modules/4825)

<div class="topic-metadata">

**Author:** [@regalartech](https://community.dreamfactory.com/u/regalartech)\
**Replies:** 0\
**Last updated:** [March 5, 2019, 7:07am UTC](https://community.dreamfactory.com/t/python-import-external-modules/4825 "2019-03-05T07:07:15Z")

</div>

can we import external modules such as if i want to create a custom excel report the i need to use XlsxWriter pypi. How to add this pypi for python script ?

[Next page](https://community.dreamfactory.com/c/server-side-scripting/14.md?page=1)
