http://coldfusion.com logo
Join Slack
Powered by
# cfml-beginners
  • e

    epipko

    12/11/2024, 9:42 PM
    This works:
    Copy code
    <cfset gql = '{"query": "{products(first: 3) {edges {node {id title} }}}"}'>
    I want to be able to save potentially larger query in this format. How do I do that? (Sending it as is will not work)
    Copy code
    <cfset gql = '{
      "query": "{
        products(first: 3) {
          edges {
            node {
              id
              title
            }
          }
        }
      }"
     }'
    >
    e
    s
    +2
    • 5
    • 64
  • e

    epipko

    12/31/2024, 7:57 AM
    I thought, with your help I was able to handle this, but ... I am still having issues with passing a GraphQL query via <cfhttp>. I came up with the query:
    Copy code
    <cfset gql = '{orders(first: 3, query: "id:>=5790166450355", sortKey: CREATED_AT) {edges {node {id name risk {recommendation } updatedAt } } } }'>
     <cfoutput>#gql#<br /><br /></cfoutput>
    This returns:
    {orders(*first*: 3, *query*: "id:>=5790166450355", sortKey: CREATED_AT) {edges {node {id *name* risk {recommendation } updatedAt } } } }
    I copy/past it into GraphiQL app in Shopify and it works just fine. When I pass it into <cfhttp>
    Copy code
    <cfhttp    
      url="<https://unionbay-clothing.myshopify.com/admin/api/2024-10/graphql.json>"         
      method="POST"
      resolveurl="true" 
      timeout="60" 
      result="httpResp">
        <cfhttpparam type="header" name="X-Shopify-Access-Token" value="secret_key" />
        <cfhttpparam type="header" name="Content-Type" value="application/json" />
        <cfhttpparam type="header" name="Accept" value="application/json" />
        <cfhttpparam type="body" value="#gql#">
     </cfhttp>
     <cfdump var="#httpResp#" abort="true">
    it returns:
    {"status":400,"error":"The json provided is not formatted correctly: Error occurred while parsing request parameters"}
    All attempts to work with Shopify support end up with "Works on our end. It must be the way your app sends in a request. Contact Adobe for help." Does anyone know if <cfhttp> actually sends cURL command on the back end?
  • e

    epipko

    12/31/2024, 7:59 AM
    graphiQL.png
    e
    e
    +2
    • 5
    • 57
  • e

    epipko

    01/15/2025, 5:35 PM
    Can anyone tell me how to deal with this error: JSON parsing failure at character 1:'<' in <html> <body> <noscript> .... caused by
    <cfset jsonData = deserializeJSON(httpResp.fileContent) />
    g
    j
    +2
    • 5
    • 30
  • e

    epipko

    01/23/2025, 6:43 PM
    I have to check order risks (determined by Shopify) on every order. Sometimes it's not available and comes back with the following: Status: 200 OK Filecontent: {"risks":[]} When I try to do the following, it fails
    <cfif #risk_httpResp.Filecontent# EQ "{"risks":[]}">
    Risk Analysis is not available
    </cfif>
    Invalid CFML construct found on line 28 at column 58 28 : <cfif #risk_httpResp.Filecontent# EQ "{"risks":[]}"> 29 : Risk Analysis is not available 30 : </cfif> Do I need to escape specific character(s)? If so, how?
    e
    a
    • 3
    • 28
  • j

    johnbarrett

    01/28/2025, 1:39 AM
    Aloha, Does anybody know of an tutorial or a CF meetup that teaches how to work with APIs in ColdFusion? I need to learn about APIs for a possible job. I am confused on why would would want to use a API, I think that they are used if you want to share your application, such as Google Maps. Any help would be gratefully appreciated. Thanks!
    j
    s
    +3
    • 6
    • 15
  • m

    molluskorg

    02/06/2025, 8:43 PM
    Hi. Does anyone have a recommendation for preserving leading zeros when using CFSPREADSHEET to export to .xlsx with CFQUERY being used to get the data for export?
    m
    s
    • 3
    • 7
  • e

    epipko

    02/28/2025, 6:28 PM
    Hi, I need to retrieve data from Shopify that is paginated. I can only get 250 records max at the time. Here is the link in Responseheader: <https://site.com/admin/api/2025-01/gift_cards.json?limit=250&page_info=eyJzdGF0dXMiOiJlbmFibGVkIiwibGFzdF9pZCI6NTA5ODMxNzA4ODUxLCJsYXN0X3ZhbHVlIjoiNTA5ODMxNzA4ODUxIiwiZGlyZWN0aW9uIjoibmV4dCJ9>; rel="next" What would be the easiest/cleanest way to look for "*next*" at the end of the link sting?
    a
    • 2
    • 15
  • d

    David Johnson

    03/03/2025, 4:06 PM
    I'm looking at updating our script-based older version of SVG-Edit. I am attempting to get to the latest stable version. However, the newer releases of SVG-Edit uses ES Modularity with commands like 'import from @svgedit/svgcanvas' and I'm not sure how CF or Lucee incorporates these modules. I've been in web scripting a while but I'm not sure how to incorporate npm or 'building' an ES module. Any tips or best practices to offer?
    a
    p
    • 3
    • 39
  • j

    johnbarrett

    03/11/2025, 5:34 AM
    i am trying to create a login system in ColdFusion, but i am stuck and could really use some help. i am using mostly modified code from the CFWACK book. The application is not working and i can't figure out why not. Am i missing something in the code? i am using an Application.cfc file and the login form, which is just a basic form, and a file to check the form. Below the code can be found. i really appreciate any help that somebody can provide. Thanks so much!
    Copy code
    <!--- Application.cfc --->                                                                                <cfcomponent output="false">
    
      <!--- Turn on session management. --->
      <cfset this.sessionManagement=true>
      <!--- Default datasource --->   
      <cfset this.dataSource="codingtask">     
    
      <cffunction name="onRequestStart" output="false" returnType="void">
      
        <!--- If user isn't logged in, force them to now ---> 
        <cfif not isDefined("session.auth.isLoggedIn")>
          <!--- If the user is now submitting "Login" form, --->
          <!--- Include "Login Check" code to validate user --->
          <cfif isDefined("form.UserLogin")> 
            <cfinclude template="loginCheck.cfm">
          </cfif>
    
          <cfinclude template="loginForm.cfm">
          <cfabort>
        </cfif> 
    
      </cffunction>
      
    </cfcomponent> 
    ----------------------------------------LoginForm.cfm-----------------------------------------------------------------<!--- If the user is now submitting "Login" form, --->
    <!--- Include "Login Check" code to validate user --->
    <cfif isDefined("form.UserLogin")> 
     <cfinclude template="LoginCheck.cfm">
    </cfif>
    
    
    
    <html>
    <head>
     <title>Please Log In</title>
    </head>
    
    <body>
    
    <!--- Start our Login Form --->
    <form action="LoginCheck.cfm" name="LoginForm" method="post">
     <!--- Use an HTML table for simple formatting --->
     <table border="0">
     <tr><th colspan="2" bgcolor="silver">Please Log In</th></tr>
     <tr>
     <th>Username:</th>
     <td>
     
     <!--- Text field for "User Name" ---> 
     <input 
     type="text"
     name="userLogin"
     size="20"
     value=""
     maxlength="100"
     required="Yes">
    
     </td>
     </tr><tr>
     <th>Password:</th>
     <td>
     
     <!--- Text field for Password ---> 
     <input 
     type="password"
     name="userPassword"
     size="12"
     value=""
     maxlength="100"
     required="Yes">
    
     <!--- Submit Button that reads "Enter" ---> 
     <input type="Submit" value="Enter">
     
     </td>
     </tr>
     </table>
     
    </form>
    
    </body>
    </html>
    --------------------------------------------LoginCheck.cfm------------------------------------------------------------<!--- Make sure we have Login name and Password --->
    <cfparam name="form.userLogin" type="string">
    <cfparam name="form.userPassword" type="string">
    
    <!--- Find record with this Username/Password --->
    <!--- If no rows returned, password not valid --->
    <cfquery name="getUser">
     SELECT ContactID, FirstName
     FROM Users
     WHERE UserLogin = 
     <cfqueryparam cfsqltype="cf_sql_varchar" value="#form.UserLogin#">
     AND UserPassword = 
     <cfqueryparam cfsqltype="cf_sql_varchar" value="#form.UserPassword#">
    </cfquery>
    
    <!--- If the username and password are correct --->
    <cfif getUser.recordCount eq 1>
     <!--- Remember user's logged-in status, plus --->
     <!--- ContactID and First Name, in structure --->
     <cfset SESSION.auth = structNew()>
     <cfset SESSION.auth.isLoggedIn = "Yes">
     <cfset SESSION.auth.contactID = getUser.contactID>
     <cfset SESSION.auth.firstName = getUser.firstName>
    
    
     <cflocation url="welcome.cfm">
    </cfif>
    😮 1
    t
    j
    +5
    • 8
    • 15
  • r

    rodyon

    03/13/2025, 11:44 AM
    reading thread above - I would advice any beginner to start with very simple, dumb examples, and build next steps on foundation of previous steps
    👍 1
  • r

    rodyon

    03/13/2025, 11:46 AM
    when reading tutorials I often see how examples presented use spaghetti of different technologies. Example - JWT and OAuth - every example I seen doing it with Javascript - it will be compulsory example building both server and client.
  • r

    rodyon

    03/13/2025, 11:48 AM
    such approach creates mess in student's head, I believe modules and concerns should be strictly separated. Building login module? Start with form and 1 cfquery, plaintext password. Then learn why plaintext passwords are bad. Learn basics of hashing and cryptography, then return and enhance dumb yesterday's example with new knowledge.
  • r

    rodyon

    03/13/2025, 11:48 AM
    just my 🪙🪙 on learning
  • e

    epipko

    03/17/2025, 6:19 PM
    I am making an API call and trying to get the size of the line_items array returned. Trying by doing this, but it errors out with "You have attempted to dereference a scalar variable of type class coldfusion.runtime.Array as a structure with members. " I don't need to loop over the jsonData array as I am making one call per transaction.
    Copy code
    <cfset jsonData = deserializeJSON(httpResp.fileContent) />
     <cfdump var=#jsonData#>
     
     <cfset item_qty = ArrayLen(jsonData.line_items)>
     <cfoutput>#item_qty#</cfoutput>
    e
    • 2
    • 2
  • d

    David Johnson

    03/20/2025, 1:54 PM
    I am incorporating the cfsimplicity Spreadsheet.cfc into my Lucee 6.1.1.118 install. I have placed the Spreadsheet.cfc file and successfully called an init. However, that is the only file that I have transferred and it would appear I have to do something with these (according to the docs) helpers/ objects/ lib-osgi.jar osgiLoader.cfc Spreadsheet.cfc Am I to take the folders out of the downloaded zip and place them in the same folder that Spreadsheet.cfc exists in? As well as the other two files?
    m
    e
    • 3
    • 9
  • d

    David Johnson

    03/20/2025, 1:55 PM
    I'm sure I'm just being thick about this, but I'm not able to derive my next move here from what I've read in the docs.
  • e

    epipko

    03/21/2025, 4:31 PM
    Really silly question, but is it possible to schedule a task BIWEEKLY in CF UI?
    e
    d
    s
    • 4
    • 11
  • e

    epipko

    03/26/2025, 9:15 PM
    Anyone interacting with Oracle NetSuite using ColdFusion?
    b
    • 2
    • 4
  • e

    epipko

    03/28/2025, 5:47 PM
    I have a strange issue with filtering equal values. Not sure why it will work for many, but not for these two.
    Copy code
    <cfif (ns_refund_amt - return_amt) NEQ 0> 
      <cfoutput>OrderID: #order_id# --- Refund_type: #refund_type# --- Qty_returned: #item_qty# --- Refund$: #ns_refund_amt# / #return_amt#</cfoutput><br />  
    </cfif>
    OrderID: xxx_--- Refund_type: 1 --- Qty_returned: 1 --- Refund$: 0 / 35_ OrderID: xxx_--- Refund_type: 1 --- Qty_returned: 1 --- Refund$: 0 / 30.1_ OrderID: xxx_--- Refund_type: 2 --- Qty_returned: 1 --- Refund$: 27.98 / 27.98_ OrderID: xxx_--- Refund_type: 2 --- Qty_returned: 4 --- Refund$: 174.69 / 70.41_ OrderID: xxx_--- Refund_type: 2 --- Qty_returned: 2 --- Refund$: 61.18 / 61.18_ OrderID: xxx_--- Refund_type: 2 --- Qty_returned: 1 --- Refund$: 60.22 / 27.61_ I also tried
    <cfif ns_refund_amt NEQ return_amt>
    w/*out* success.
    e
    r
    +2
    • 5
    • 35
  • a

    Aaron Linder

    03/29/2025, 11:53 PM
    @Mark Takata (Adobe) when time permits can I get a sticky of the website tree to begin looking things up like the youtube channel, github channel and official adobe or community system?
  • m

    Mark Takata (Adobe)

    03/29/2025, 11:54 PM
    Yeah absolutely I can send something over
  • a

    Aaron Linder

    03/29/2025, 11:54 PM
    just put on the #C1QB85ZJ5 channel sticky for everyone but I can keep it individually also
  • m

    Mark Takata (Adobe)

    03/29/2025, 11:55 PM
    Learn CF in a week https://learncfinaweek.com/ This is a basic introduction to Adobe ColdFusion that focuses on the underlying CFML language structure (vs the more modern CFScript based programming). Today, CFML is used primarily to create views. This will give you a nice intro to how CFML works, and you can run through it quickly. Learn Modern CFML in 100+ Minutes https://modern-cfml.ortusbooks.com/ This is a more advanced book that covers ColdFusion from a modern perspective. Adobe ColdFusion YouTube https://www.youtube.com/@adobecoldfusion/videos This is Adobe’s ColdFusion channel on YouTube and includes a huge array of talks on how to build applications, optimize your installation, integrate with front-end frameworks, and more. CF Docs https://cfdocs.org/ These are nicely arranged, community driven, documentation for all CFML frameworks. You can find sample code here for functions, methods, etc.
    ❤️ 1
    ✅ 1
  • m

    Mark Takata (Adobe)

    03/29/2025, 11:56 PM
    Ortus CommandBox https://www.ortussolutions.com/products/commandbox This is an incredibly simple way to get Adobe ColdFusion installed and running on your local machine. You simply go to their CLI and do a server start with Adobe ColdFusion latest and presto: you’re running. CFFiddle https://cffiddle.org/ Online Adobe ColdFusion testing site. Has some limits on functions for security, but for the most part has everything you’d want for testing out stuff. Docker Hub ColdFusion https://hub.docker.com/r/adobecoldfusion/coldfusion https://helpx.adobe.com/coldfusion/using/docker-images-coldfusion.html If you prefer to use ColdFusion in Docker, we have that! First link is where the images live. Second link is our documentation on how to use the environment variables. Demo download https://www.adobe.com/products/coldfusion/download-trial/try.html You can download a trial of ColdFusion here. If you set the type to developer, and the deployment to developer, it is free forever (with watermarks on PDF and a 3 connection simultaneous limit).
  • a

    Aaron Linder

    03/29/2025, 11:56 PM
    I got it for you
  • a

    Aaron Linder

    03/29/2025, 11:56 PM
    I did it
    👍 2
  • e

    epipko

    04/16/2025, 9:35 PM
    Hi, is there a way in Cf to format <cfinput> for currency?
    b
    e
    +2
    • 5
    • 6
  • d

    David Johnson

    04/30/2025, 3:19 PM
    My .CommandBox server folder has three UUID-type folders, and within the folder with the latest date, there are folders for adobe-2018.x.x, lucee-5.xxx, lucee-6.1.x and lucee-6.2.x. Is it okay to remove some of the older ones? I felt it might be better to have this area cleaned up.
    m
    b
    • 3
    • 3
  • g

    Gaurav Sharma

    05/01/2025, 1:24 PM
    Hi, I have converted HTML pages to PowerPoint Presentation in Coldfusion using <cfpresentation> and <cfpresentationslide> but facing an issue with this as after downloading (.ppt) file I am able to edit text and images but not able to change theme of slides which are available in PowerPoint Presentation. This is because of <cfpresentationslide> is creating static slides only which cannot override themes on slides, let me know if anyone have solution to resolve this.
    webpage (2).ppt
    b
    • 2
    • 2