web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Service | Customer Service, Contact Center, Fie...
Unanswered

Resco Offline Html printing - Field Service App

(0) ShareShare
ReportReport
Posted on by 144

Hi All,

I need to print an offline HTML file in filed service mobile app(Resco App). I have used the following function.

function print() {

var service = new MobileCRM.Services.DocumentService();
service.print("file://OfflineInvoice.htm", false, MobileCRM.bridge.alert, null);
}

But when I try to print it does not show dynamic content of the file.

Output

pastedimage1574163454359v2.png

Expected output

pastedimage1574163387419v1.png

Could you please help me to resolve this issue?

Thanks

Ajith

  • Thomas David Dayman Profile Picture
    11,323 on at

    Are you trying to print a mobile report?

    I think the service.print function just reads a file and prints it, it doesn't dynamically create the report.

    Are you creating the report before you print the file?

  • aindike Profile Picture
    144 on at

    Hi Thomas,

    I am not using a mobile report. I have created a custom offline js and I need to print it. Before, print I am creating a report.

    pastedimage1574165445246v1.png

    when print button click, I need to print the report.

    Thanks

    Ajith

  • Thomas David Dayman Profile Picture
    11,323 on at

    Maybe you need to save the html file with the populated data before you print. Its hard to say.

    Is it possible to see your code?

  • aindike Profile Picture
    144 on at

    How can I save the HTML file? I can send you the code using LinkedIn because It is bit large file to copy here.

    Thanks

  • Thomas David Dayman Profile Picture
    11,323 on at

    Hi Ajith, yeah you can send it to me via linkedin. Ill try and have a look when I have some free time

  • aindike Profile Picture
    144 on at

    Thanks. Could you please tell me, how can I save HTML file?

  • Thomas David Dayman Profile Picture
    11,323 on at

    I dont know exactly needs to be coded in terms of syntax.

    But I assume you are writing the dynamic values to a html DOM and once you have done that you just need to save that html DOM somewhere locally then you can print the file.

  • Community Member Profile Picture
    on at

    Hi Ajith

    can you send the .js file with code, i am curious to ser how you have written the code. 

  • aindike Profile Picture
    144 on at

    Hi Akelan,

    How could I send the file to you?

    Thanks,

    Ajith

  • Thomas David Dayman Profile Picture
    11,323 on at

    <body onload="show()" id="printJS-form">
    <table>
    <tr>
    <th>
    <img id="img-logo" width="200" height="100" />
    <br />Confirmation of Service
    <br />TAX Invoice
    <br />....................................
    </th>
    </tr>
    <tr>
    <td></td>
    <td></td>
    </tr>
    </table>

    <!--<p><button onclick="show()">Generate Invoice</button></p>-->
    <p><button onclick="cal()">Calculate Invoice Total</button></p>
    <p><b>JOB DETAILS</b></p>
    <span id="JobDetails">
    </span>
    <p><b>SALES DETAILS</b></p>
    <p><b>Product</b></p>
    <span id="product">
    </span>
    <p><b>Services</b></p>
    <br />
    <span id="service">
    </span>
    <span id="product2">
    </span>
    <span id="product3">
    </span>
    <img id="img-result" width="200" height="100" />

    <!--//<p><button onclick="print()">Print</button></p>-->

    <button type="button" onclick="printJS('printJS-form', 'html')">
    Print Form
    </button>
    </body>

    Above is the HTML that Ajith sent me via LinkedIn. I have removed the JavaScript which populates the HTML dynamically. (The code looks fine). I think the issue here is that when you go and print the file it only reads the html stated in the code above, it doesn't include your values that you have added dynamically as this is only added in real time on the front end, this is not saved to the file directly. Once you have populated the html with your values, somehow you will need save the html generated as a file and print this file instead.

    This part i'm not so sure to achieve as I haven't done this before. Maybe a quick google can put you in the right direction like below:

    https://stackoverflow.com/questions/8792950/how-make-a-dynamic-or-generated-html-page-savable

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Leaderboard > Service | Customer Service, Contact Center, Field Service, Guides

#1
11manish Profile Picture

11manish 44 Super User 2026 Season 2

#2
Travis South Profile Picture

Travis South 41

#3
Ayesha Wajahat Profile Picture

Ayesha Wajahat 18

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans