Skip to main content

Notifications

Announcements

No record found.

Service | Customer Service, Contact Center, Fie...
Unanswered

Resco Offline Html printing - Field Service App

(0) ShareShare
ReportReport
Posted on by 140

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

  • aindike Profile Picture
    aindike 140 on at
    RE: Resco Offline Html printing - Field Service App

    Hi All,

    Thank you very much.

    Thanks,

    Ajith

  • Thomas David Dayman Profile Picture
    Thomas David Dayman 11,323 on at
    RE: Resco Offline Html printing - Field Service App

    <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

  • aindike Profile Picture
    aindike 140 on at
    RE: Resco Offline Html printing - Field Service App

    Hi Akelan,

    How could I send the file to you?

    Thanks,

    Ajith

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Resco Offline Html printing - Field Service App

    Hi Ajith

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

  • Thomas David Dayman Profile Picture
    Thomas David Dayman 11,323 on at
    RE: Resco Offline Html printing - Field Service App

    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.

  • aindike Profile Picture
    aindike 140 on at
    RE: Resco Offline Html printing - Field Service App

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

  • Thomas David Dayman Profile Picture
    Thomas David Dayman 11,323 on at
    RE: Resco Offline Html printing - Field Service App

    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
    aindike 140 on at
    RE: Resco Offline Html printing - Field Service App

    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
    Thomas David Dayman 11,323 on at
    RE: Resco Offline Html printing - Field Service App

    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
    aindike 140 on at
    RE: Resco Offline Html printing - Field Service App

    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

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,431 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,503 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans